#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
 Calculate the interval for the segment of a line that is in the clip plane region. More...
 
int InClipPlaneRegion (ON_3dPoint P) const
 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. More...
 
int InClipPlaneRegion (const ON_BoundingBox &bbox) const
 
int InClipPlaneRegion (int count, const ON_3fPoint *p) const
 
int InClipPlaneRegion (int count, const ON_3dPoint *p) const
 
int InClipPlaneRegion (int count, const ON_4dPoint *p) const
 
ON_Xform InverseObjectToClipTransformation () const
 
int InViewFrustum (ON_3dPoint P) const
 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. More...
 
int InViewFrustum (const ON_BoundingBox &bbox) const
 
int InViewFrustum (int count, const ON_3fPoint *p) const
 
int InViewFrustum (int count, const ON_3dPoint *p) const
 
int InViewFrustum (int count, const ON_4dPoint *p) const
 
int IsVisible (ON_3dPoint P) const
 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 determing if some portion of the convex hull of the test points is visible. More...
 
int IsVisible (const ON_BoundingBox &bbox) const
 
int IsVisible (int count, const ON_3fPoint *p) const
 
int IsVisible (int count, const ON_3dPoint *p) const
 
int IsVisible (int count, const ON_4dPoint *p) const
 
ON_Xform ObjectToClipTransformation () const
 
void SetClipPlaneTolerance (double clip_plane_tolerance)
 
bool SetObjectToClipTransformation (const class ON_Viewport &viewport)
 Sets the object to clip transformation to the viewport's workd to clip transformation. More...
 
bool SetObjectToClipTransformation (const ON_Xform object_to_clip_transformation)
 
unsigned int TransformPoint (const ON_4dPoint &P, ON_4dPoint &Q) const
 Transform a pont and return the clipping information. More...
 
unsigned int TransformPoint (const ON_3dPoint &P, ON_3dPoint &Q) const
 
unsigned int TransformPoint (const ON_3fPoint &P, ON_3dPoint &Q) const
 
int TransformPoints (int count, ON_4dPoint *p) const
 Transform a list of 4d homogenous points while testing for visibility. More...
 
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
 

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
max_clip_plane_count 
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.

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

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 ( ON_3dPoint  P) const

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.

◆ InClipPlaneRegion() [2/5]

int ON_ClippingRegion::InClipPlaneRegion ( const ON_BoundingBox bbox) 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_3dPoint p 
) const

◆ InClipPlaneRegion() [5/5]

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

◆ InverseObjectToClipTransformation()

ON_Xform ON_ClippingRegion::InverseObjectToClipTransformation ( ) const

◆ InViewFrustum() [1/5]

int ON_ClippingRegion::InViewFrustum ( ON_3dPoint  P) const

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 otested points may be in the view frustum. 2 = The entire convex hull of the tested points is in the view frustum.

◆ InViewFrustum() [2/5]

int ON_ClippingRegion::InViewFrustum ( const ON_BoundingBox bbox) 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_3dPoint p 
) const

◆ InViewFrustum() [5/5]

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

◆ IsVisible() [1/5]

int ON_ClippingRegion::IsVisible ( ON_3dPoint  P) const

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 determing 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

◆ IsVisible() [2/5]

int ON_ClippingRegion::IsVisible ( const ON_BoundingBox bbox) 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_3dPoint p 
) const

◆ IsVisible() [5/5]

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

◆ 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.

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)

Sets the object to clip transformation to the viewport's workd 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_4dPoint P,
ON_4dPoint Q 
) const

Transform a pont 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 intput point. 0x01 left of the view frusturm 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

◆ TransformPoint() [2/3]

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

◆ TransformPoint() [3/3]

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

◆ TransformPoints() [1/2]

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

Transform a list of 4d homogenous 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 intput point. 0x01 left of the view frusturm 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