Rhino C++ API  8.13
Public Types | Public Member Functions | Public Attributes | List of all members
ON_ClippingRegion Class Reference

#include <opennurbs_xform.h>

Public Types

enum  {
  max_clip_plane_count = 16, frustum_bitmask = 0x0000003F, near_plane_bitmask = 0x00000020, far_plane_bitmask = 0x00000010,
  clip_plane_bitmask = 0x7FFFFFC0, negw_bitmask = 0x80000000
}
 

Public Member Functions

 ON_ClippingRegion ()
 
double ClipPlaneTolerance () const
 
bool GetLineClipPlaneParamters (ON_4dPoint P0, ON_4dPoint P1, double *t0, double *t1) const
 
int InClipPlaneRegion (const ON_BoundingBox &bbox) const
 
int InClipPlaneRegion (int count, const ON_3dPoint *p) const
 
int InClipPlaneRegion (int count, const ON_3fPoint *p) const
 
int InClipPlaneRegion (int count, const ON_4dPoint *p) const
 
int InClipPlaneRegion (ON_3dPoint P) const
 
ON_Xform InverseObjectToClipTransformation () const
 
int InViewFrustum (const ON_BoundingBox &bbox) const
 
int InViewFrustum (int count, const ON_3dPoint *p) const
 
int InViewFrustum (int count, const ON_3fPoint *p) const
 
int InViewFrustum (int count, const ON_4dPoint *p) const
 
int InViewFrustum (ON_3dPoint P) const
 
int IsVisible (const ON_BoundingBox &bbox) const
 
int IsVisible (int count, const ON_3dPoint *p) const
 
int IsVisible (int count, const ON_3fPoint *p) const
 
int IsVisible (int count, const ON_4dPoint *p) const
 
int IsVisible (ON_3dPoint P) const
 
ON_Xform ObjectToClipTransformation () const
 
void SetClipPlaneTolerance (double clip_plane_tolerance)
 
bool SetObjectToClipTransformation (const class ON_Viewport &viewport)
 
bool SetObjectToClipTransformation (const ON_Xform object_to_clip_transformation)
 
unsigned int TransformPoint (const ON_3dPoint &P, ON_3dPoint &Q) const
 
unsigned int TransformPoint (const ON_3fPoint &P, ON_3dPoint &Q) const
 
unsigned int TransformPoint (const ON_4dPoint &P, ON_4dPoint &Q) const
 
int TransformPoints (int count, ON_4dPoint *p) const
 
int TransformPoints (int count, ON_4dPoint *p, unsigned int *pflags) const
 

Public Attributes

ON_PlaneEquation m_clip_plane [max_clip_plane_count]
 
int m_clip_plane_count
 (0 <= m_clip_plane_count <= max_clip_plane_count) More...
 

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
max_clip_plane_count 

must be <= 25

frustum_bitmask 
near_plane_bitmask 
far_plane_bitmask 
clip_plane_bitmask 
negw_bitmask 

Constructor & Destructor Documentation

◆ ON_ClippingRegion()

ON_ClippingRegion::ON_ClippingRegion ( )

Member Function Documentation

◆ ClipPlaneTolerance()

double ON_ClippingRegion::ClipPlaneTolerance ( ) const

Returns: 3d world coordinates tolerance to use when testing objects to see if the planes in m_clip_plane[] hide the objects.
Remarks: The constructor sets this value to zero. Rhino uses values around 1e-5.

◆ GetLineClipPlaneParamters()

bool ON_ClippingRegion::GetLineClipPlaneParamters ( ON_4dPoint  P0,
ON_4dPoint  P1,
double *  t0,
double *  t1 
) const

Description: Calculate the interval for the segment of a line that is in the clip plane region. Parameters: P0 - [in] start point P1 - [in] end point t0 - [out] start parameter t1 - [out] end parameter Returns: True if some portion of the line is visible and 0.0 <= *t0 <= *t1 <= 1.0.

◆ InClipPlaneRegion() [1/5]

int ON_ClippingRegion::InClipPlaneRegion ( const ON_BoundingBox bbox) const

◆ InClipPlaneRegion() [2/5]

int ON_ClippingRegion::InClipPlaneRegion ( int  count,
const ON_3dPoint p 
) const

◆ InClipPlaneRegion() [3/5]

int ON_ClippingRegion::InClipPlaneRegion ( int  count,
const ON_3fPoint p 
) const

◆ InClipPlaneRegion() [4/5]

int ON_ClippingRegion::InClipPlaneRegion ( int  count,
const ON_4dPoint p 
) const

◆ InClipPlaneRegion() [5/5]

int ON_ClippingRegion::InClipPlaneRegion ( ON_3dPoint  P) const

Description: The "clip plane region" is the convex hull of the planes in the m_clip_plane[] array. These functions determine if some portion of the convex hull of the test points is inside the clip plane region. Parameters: P - [in] point box - [in] bounding box count - [in] number of points p - [in] array of points bEnableClippingPlanes - [in] If true, then the additional clipping planes are tested. If false, then the additional clipping planes are ignored. Returns: 0 = No part of the of the convex hull of the tested points is in the clip plane region. 1 = A portion of the convex hull of the tested points may be in the clip plane region. 2 = The entire convex hull of the tested points is in the clip plane region.

◆ InverseObjectToClipTransformation()

ON_Xform ON_ClippingRegion::InverseObjectToClipTransformation ( ) const

◆ InViewFrustum() [1/5]

int ON_ClippingRegion::InViewFrustum ( const ON_BoundingBox bbox) const

◆ InViewFrustum() [2/5]

int ON_ClippingRegion::InViewFrustum ( int  count,
const ON_3dPoint p 
) const

◆ InViewFrustum() [3/5]

int ON_ClippingRegion::InViewFrustum ( int  count,
const ON_3fPoint p 
) const

◆ InViewFrustum() [4/5]

int ON_ClippingRegion::InViewFrustum ( int  count,
const ON_4dPoint p 
) const

◆ InViewFrustum() [5/5]

int ON_ClippingRegion::InViewFrustum ( ON_3dPoint  P) const

Description: The "view frustum" is the frustum the m_xform transformation maps to clipping coordinate box (-1,+1)^3. These functions determine if some portion of the convex hull of the test points is inside the view frustum. Parameters: P - [in] point box - [in] bounding box count - [in] number of points p - [in] array of points bEnableClippingPlanes - [in] If true, then the additional clipping planes are tested. If false, then the additional clipping planes are ignored. Returns: 0 = No part of the of the convex hull of the tested points is in the view frustum. 1 = A portion of the convex hull of the tested points may be in the view frustum. 2 = The entire convex hull of the tested points is in the view frustum.

◆ IsVisible() [1/5]

int ON_ClippingRegion::IsVisible ( const ON_BoundingBox bbox) const

◆ IsVisible() [2/5]

int ON_ClippingRegion::IsVisible ( int  count,
const ON_3dPoint p 
) const

◆ IsVisible() [3/5]

int ON_ClippingRegion::IsVisible ( int  count,
const ON_3fPoint p 
) const

◆ IsVisible() [4/5]

int ON_ClippingRegion::IsVisible ( int  count,
const ON_4dPoint p 
) const

◆ IsVisible() [5/5]

int ON_ClippingRegion::IsVisible ( ON_3dPoint  P) const

Description: The "visible area" is the intersection of the view frustum, defined by m_xform, and the clipping region, defined by the m_clip_plane[] array. These functions determine if some portion of the convex hull of the test points is visible. Parameters: P - [in] point box - [in] bounding box count - [in] number of points p - [in] array of points Returns: 0 = no part of the object is in the region. 1 = a portion of the object is in the region 2 = entire object is in clipping region

◆ ObjectToClipTransformation()

ON_Xform ON_ClippingRegion::ObjectToClipTransformation ( ) const

◆ SetClipPlaneTolerance()

void ON_ClippingRegion::SetClipPlaneTolerance ( double  clip_plane_tolerance)

Parameters: clip_plane_tolerance - [in]
3d world coordinates tolerance to use when testing objects to see if the planes in m_clip_plane[] hide the objects.
Remarks: The constructor sets this value to zero. Rhino uses values around 1e-5.

◆ SetObjectToClipTransformation() [1/2]

bool ON_ClippingRegion::SetObjectToClipTransformation ( const class ON_Viewport viewport)

Description: Sets the object to clip transformation to the viewport's world to clip transformation.

◆ SetObjectToClipTransformation() [2/2]

bool ON_ClippingRegion::SetObjectToClipTransformation ( const ON_Xform  object_to_clip_transformation)

◆ TransformPoint() [1/3]

unsigned int ON_ClippingRegion::TransformPoint ( const ON_3dPoint P,
ON_3dPoint Q 
) const

◆ TransformPoint() [2/3]

unsigned int ON_ClippingRegion::TransformPoint ( const ON_3fPoint P,
ON_3dPoint Q 
) const

◆ TransformPoint() [3/3]

unsigned int ON_ClippingRegion::TransformPoint ( const ON_4dPoint P,
ON_4dPoint Q 
) const

Description: Transform a point and return the clipping information. Parameters: P - [in] point ot transform Q - [out] transformed point Returns: 0 when the point is in the visible region.
Otherwise the bits are set to indicate which planes clip the input point. 0x01 left of the view frustum 0x02 right of the view frustum 0x04 below the view frustum 0x08 above the view frustum 0x10 behind the view frustum (too far) 0x20 in front of the view frustum (too near)

0x10 below m_clip_plane[0] 0x20 below m_clip_plane[1] ... 0x40000000 below m_clip_plane[24]

0x80000000 transformation created a non-positive weight

◆ TransformPoints() [1/2]

int ON_ClippingRegion::TransformPoints ( int  count,
ON_4dPoint p 
) const

Description: Transform a list of 4d homogeneous points while testing for visibility. Parameters: count - [in] number of points p - [in/out] array of points to test and transform If 0 is returned, some of the points may not be transformed. In all other cases, the output points are transformed by m_xform. pflags - [out] 0 when the point is in the visible region.
Otherwise the bits are set to indicate which planes clip the input point. 0x01 left of the view frustum 0x02 right of the view frustum 0x04 below the view frustum 0x08 above the view frustum 0x10 behind the view frustum (too far) 0x20 in front of the view frustum (too near)

0x10 below m_clip_plane[0] 0x20 below m_clip_plane[1] ... 0x40000000 below m_clip_plane[24]

0x80000000 transformation created a non-positive weight Returns: 0 = convex hull of the points is not in the region. The m_cull_bits field reports which plane or planes culled the point set. 1 = a portion of the convex hull is in the region. The m_cull_bits field reports which plane or planes culled the point set. 2 = all points are in the region. The m_cull_bits field will be zero.

◆ TransformPoints() [2/2]

int ON_ClippingRegion::TransformPoints ( int  count,
ON_4dPoint p,
unsigned int *  pflags 
) const

Member Data Documentation

◆ m_clip_plane

ON_PlaneEquation ON_ClippingRegion::m_clip_plane[max_clip_plane_count]

◆ m_clip_plane_count

int ON_ClippingRegion::m_clip_plane_count

(0 <= m_clip_plane_count <= max_clip_plane_count)

Up to 25 additional clipping planes in object coordinates. The convex region that is the intersection of the positive side of these planes is the active region.