Rhino C++ API  8.14
Public Member Functions | Public Attributes | List of all members
ON_CurveTreeNode Class Reference

#include <opennurbs_plus.h>

Inheritance diagram for ON_CurveTreeNode:
ON_CurveTree

Public Member Functions

 ON_CurveTreeNode ()
 
 ~ON_CurveTreeNode ()
 
bool AdjustParameter () const
 
const ON_CurveTreeNodeEvaluate (double t, int der_count, int v_stride, double *v, int side=0) const
 
const ON_CurveTreeNodeFindLeaf (double t, int side=0) const
 
const ON_CurveTreeNodeGetClosestPoint (ON_3dPoint P, double *t, ON_3dPoint *closestpt=0, double maximum_distance=0.0, const ON_Interval *cdomain=0) const
 
bool GetTightBoundingBox (ON_BoundingBox &bbox, bool bGrowBox=false, const ON_Xform *xform=nullptr) const
 
int IntersectCurve (const class ON_CurveTreeNode *cnodeB, ON_SimpleArray< ON_X_EVENT > &x, double intersection_tolerance=0.0, double overlap_tolerance=0.0, const ON_Interval *curveA_domain=0, const ON_Interval *curveB_domain=0) const
 
int IntersectPlane (const class ON_Plane &plane, ON_SimpleArray< ON_X_EVENT > &x, double intersection_tolerance=0.0, double overlap_tolerance=0.0, const ON_Interval *curve_domain=0) const
 
int IntersectPlane (const class ON_PlaneEquation &plane_equation, ON_SimpleArray< ON_X_EVENT > &x, double intersection_tolerance=0.0, double overlap_tolerance=0.0, const ON_Interval *curve_domain=0) const
 
int IntersectSelf (ON_SimpleArray< ON_X_EVENT > &x, double intersection_tolerance=0.0, const ON_Interval *curve_domain=0) const
 
int IntersectSurface (const class ON_SurfaceTreeNode *snodeB, ON_SimpleArray< ON_X_EVENT > &x, double intersection_tolerance=0.0, double overlap_tolerance=0.0, const ON_Interval *curveA_domain=0, const ON_Interval *surfaceB_udomain=0, const ON_Interval *surfaceB_vdomain=0) const
 
bool IsFartherThan (double d, const ON_3dPoint &P) const
 
bool IsFartherThan (double d, const ON_CurveTreeNode *other) const
 
bool IsFartherThan (double d, const ON_PlaneEquation &e) const
 
bool IsFartherThan (double d, const ON_SurfaceTreeNode *other) const
 
bool IsFartherThanAlt (double d, const ON_SurfaceTreeNode *other) const
 todo is this really the final soln More...
 
bool IsValid (ON_TextLog *text_log=0, int level=0, int side=-1, const ON_Curve *curve=0) const
 
double MaximumDistanceUpperBound (const ON_CurveTreeNode *other) const
 
double MaximumDistanceUpperBound (const ON_SurfaceTreeNode *other) const
 
double MaximumDistanceUpperBound (ON_3dPoint P) const
 
double MinimumDistanceLowerBound (const ON_CurveTreeNode *other) const
 
double MinimumDistanceLowerBound (const ON_SurfaceTreeNode *other) const
 
double MinimumDistanceLowerBound (ON_3dPoint P) const
 
double MinimumDistanceUpperBound (const ON_CurveTreeNode *other) const
 
double MinimumDistanceUpperBound (const ON_SurfaceTreeNode *other) const
 
double MinimumDistanceUpperBound (ON_3dPoint P) const
 
ON_CurveTreeNodeNextLeaf () const
 
ON_CurveTreeNodePrevLeaf () const
 
bool SetBezier (const ON_BezierCurve &Crv)
 
bool SetBezier (int dim, bool is_rat, int order, const double *cv, int stride)
 
bool Split (double s, ON_CurveTreeNode &left_node, ON_CurveTreeNode &right_node) const
 
const ON_CurveTreeNodeTreeContaining (double t0, int side) const
 
const ON_CurveTreeNodeTreeContaining (ON_Interval range) const
 

Public Attributes

ON_BoundingBox m_bbox
 
ON_CurveTreeBezierm_bez
 
unsigned char m_bezmem
 
ON_Interval m_domain
 
ON_CurveTreeNodem_down [2]
 
unsigned char m_nodemem
 
unsigned int m_nodesn
 serial number of this node More...
 
unsigned char m_nodetype
 Memory management accounting information. More...
 
unsigned char m_reserved_ON_CurveTreeNode [5]
 keep class size a multiple of 16 More...
 
unsigned int m_treesn
 serial number of this tree More...
 
ON_CurveTreeNodem_up
 

Detailed Description

A curve cache is a simple binary tree of bezier curves and is used to speed up geometric calculations.

Constructor & Destructor Documentation

◆ ON_CurveTreeNode()

ON_CurveTreeNode::ON_CurveTreeNode ( )

◆ ~ON_CurveTreeNode()

ON_CurveTreeNode::~ON_CurveTreeNode ( )

Member Function Documentation

◆ AdjustParameter()

bool ON_CurveTreeNode::AdjustParameter ( ) const

Description: Used to determine if the node's parametization differs from the tree's curve parametization. If the parameterizations are different, then use ON_Curve::GetCurveParameterFromNurbFormParameter to convert node parameters to curve parameters and ON_Curve::GetCurveParameterFromNurbFormParameter to convert curve parameters to node parameters. Returns: True if the node's parametization differs from the tree's curve parametization. See Also: ON_Curve::GetCurveParameterFromNurbFormParameter ON_Curve::GetCurveParameterFromNurbFormParameter

◆ Evaluate()

const ON_CurveTreeNode* ON_CurveTreeNode::Evaluate ( double  t,
int  der_count,
int  v_stride,
double *  v,
int  side = 0 
) const

Description: Evaluate the portion of the curve covered by this node. Parameters: t - [in] evaluation parameter with respect to the node's domain. der_count - [in] (>=0) number of derivatives to evaluate v_stride - [in] stride to use for the v[] array v - [out] array of length (der_count+1)*v_stride curve(t) is returned in (v[0],...,v[m_dim-1]), curve'(t) is returned in (v[v_stride],...,v[v_stride+m_dim-1]), curve"(t) is returned in (v[2*v_stride],...,v[2*v_stride+m_dim-1]), etc. side - [in] optional - determines which side to evaluate from =0 default (from above) <0 to evaluate from below, >0 to evaluate from above Returns: If successful, returns a pointer to the leaf node that was used in the evaluation. If null is returned, the evaluation could not be performed. Remarks: If the evaluation parameter is outside this node's domain, the bezier on the appropriate end is used to ev

◆ FindLeaf()

const ON_CurveTreeNode* ON_CurveTreeNode::FindLeaf ( double  t,
int  side = 0 
) const

Description: Starting at this node, find the leaf node whose domain contains that parameter t. Parameters: t - [in] side [in] If t lies at the start/end of a domain, side controls which leaf is returned. If side >= 0, the node with domain (t,...) is returned. If side < 0, the node with domain (...,t) is returned. Returns: Pointer to the node that contains t. If t < the start of this node's domain, the node for the start is returned. If t > the end of this node's domain, the node for the end parameter is returned.

◆ GetClosestPoint()

const ON_CurveTreeNode* ON_CurveTreeNode::GetClosestPoint ( ON_3dPoint  P,
double *  t,
ON_3dPoint closestpt = 0,
double  maximum_distance = 0.0,
const ON_Interval cdomain = 0 
) const

◆ GetTightBoundingBox()

bool ON_CurveTreeNode::GetTightBoundingBox ( ON_BoundingBox bbox,
bool  bGrowBox = false,
const ON_Xform xform = nullptr 
) const

Description: Get tight bounding box of the portion of the curve covered by this node. Parameters: tight_bbox - [in/out] tight bounding box bGrowBox -[in] (default=false)
If true and the input tight_bbox is valid, then returned tight_bbox is the union of the input tight_bbox and the node's tight bounding box. xform -[in] (default=nullptr) If not nullptr, the tight bounding box of the transformed node is calculated. The node is not modified. Returns: True if the returned tight_bbox is set to a valid bounding box.

◆ IntersectCurve()

int ON_CurveTreeNode::IntersectCurve ( const class ON_CurveTreeNode cnodeB,
ON_SimpleArray< ON_X_EVENT > &  x,
double  intersection_tolerance = 0.0,
double  overlap_tolerance = 0.0,
const ON_Interval curveA_domain = 0,
const ON_Interval curveB_domain = 0 
) const

◆ IntersectPlane() [1/2]

int ON_CurveTreeNode::IntersectPlane ( const class ON_Plane plane,
ON_SimpleArray< ON_X_EVENT > &  x,
double  intersection_tolerance = 0.0,
double  overlap_tolerance = 0.0,
const ON_Interval curve_domain = 0 
) const

◆ IntersectPlane() [2/2]

int ON_CurveTreeNode::IntersectPlane ( const class ON_PlaneEquation plane_equation,
ON_SimpleArray< ON_X_EVENT > &  x,
double  intersection_tolerance = 0.0,
double  overlap_tolerance = 0.0,
const ON_Interval curve_domain = 0 
) const

◆ IntersectSelf()

int ON_CurveTreeNode::IntersectSelf ( ON_SimpleArray< ON_X_EVENT > &  x,
double  intersection_tolerance = 0.0,
const ON_Interval curve_domain = 0 
) const

◆ IntersectSurface()

int ON_CurveTreeNode::IntersectSurface ( const class ON_SurfaceTreeNode snodeB,
ON_SimpleArray< ON_X_EVENT > &  x,
double  intersection_tolerance = 0.0,
double  overlap_tolerance = 0.0,
const ON_Interval curveA_domain = 0,
const ON_Interval surfaceB_udomain = 0,
const ON_Interval surfaceB_vdomain = 0 
) const

◆ IsFartherThan() [1/4]

bool ON_CurveTreeNode::IsFartherThan ( double  d,
const ON_3dPoint P 
) const

◆ IsFartherThan() [2/4]

bool ON_CurveTreeNode::IsFartherThan ( double  d,
const ON_CurveTreeNode other 
) const

◆ IsFartherThan() [3/4]

bool ON_CurveTreeNode::IsFartherThan ( double  d,
const ON_PlaneEquation e 
) const

Description: Quickly determine if the shortest distance from the point P to the portion of the curve covered by this node is greater than d. Parameters: d - [in] distance (> 0.0) P - [in] other - [in] Returns: True if if the shortest distance from the point P to the portion of the curve covered by this node is greater than d. Remarks: This is conceptually the same but faster than calling MinimumDistanceUpperBound(other) > d.

◆ IsFartherThan() [4/4]

bool ON_CurveTreeNode::IsFartherThan ( double  d,
const ON_SurfaceTreeNode other 
) const

◆ IsFartherThanAlt()

bool ON_CurveTreeNode::IsFartherThanAlt ( double  d,
const ON_SurfaceTreeNode other 
) const

todo is this really the final soln

◆ IsValid()

bool ON_CurveTreeNode::IsValid ( ON_TextLog text_log = 0,
int  level = 0,
int  side = -1,
const ON_Curve curve = 0 
) const

◆ MaximumDistanceUpperBound() [1/3]

double ON_CurveTreeNode::MaximumDistanceUpperBound ( const ON_CurveTreeNode other) const

◆ MaximumDistanceUpperBound() [2/3]

double ON_CurveTreeNode::MaximumDistanceUpperBound ( const ON_SurfaceTreeNode other) const

◆ MaximumDistanceUpperBound() [3/3]

double ON_CurveTreeNode::MaximumDistanceUpperBound ( ON_3dPoint  P) const

Description: Quickly find an upper bound on the distance from a P to the portion of the curve covered by this node. Parameters: P - [in] Returns: A distance that is greater than or equal to the longest distance from P to a point on the curve covered by this node. Put another way, if Q is any point on the portion of the curve covered by this node, then P.DistanceTo(Q) <= MaximumDistanceTo(P);

◆ MinimumDistanceLowerBound() [1/3]

double ON_CurveTreeNode::MinimumDistanceLowerBound ( const ON_CurveTreeNode other) const

◆ MinimumDistanceLowerBound() [2/3]

double ON_CurveTreeNode::MinimumDistanceLowerBound ( const ON_SurfaceTreeNode other) const

◆ MinimumDistanceLowerBound() [3/3]

double ON_CurveTreeNode::MinimumDistanceLowerBound ( ON_3dPoint  P) const

Description: Quickly find a lower bound on the distance from this curve node to the other object. Parameters: P - [in] other - [in] Returns: A distance that is less than or equal to the shortest distance from this curve node to the other object. Put another way, if Q is any point Q on the portion of the curve covered by this node and P is any point on the other object, then P.DistanceTo(Q) >= MinimumDistanceTo();

◆ MinimumDistanceUpperBound() [1/3]

double ON_CurveTreeNode::MinimumDistanceUpperBound ( const ON_CurveTreeNode other) const

◆ MinimumDistanceUpperBound() [2/3]

double ON_CurveTreeNode::MinimumDistanceUpperBound ( const ON_SurfaceTreeNode other) const

◆ MinimumDistanceUpperBound() [3/3]

double ON_CurveTreeNode::MinimumDistanceUpperBound ( ON_3dPoint  P) const

Description: Quickly find an upper bound on the shortest distance from this curve node to the other object. Parameters: P - [in] other - [in] Returns: A distance that is greater than or equal to the shortest distance from this curve node to the other object. Put another way, there exists a point Q on the portion of the curve covered by this node and a point P on the other object such that P.DistanceTo(Q) <= MinimumDistanceUpperBound();

◆ NextLeaf()

ON_CurveTreeNode* ON_CurveTreeNode::NextLeaf ( ) const

Next() moves to the next leaf interval in the curve tree if this node is a leaf node.

◆ PrevLeaf()

ON_CurveTreeNode* ON_CurveTreeNode::PrevLeaf ( ) const

Prev() moves to the previous leaf interval in the curve tree if this node is a leaf node.

◆ SetBezier() [1/2]

bool ON_CurveTreeNode::SetBezier ( const ON_BezierCurve Crv)

Set from a bezier or from the defining data for a bezier. Sets m_bbox, m_bez, m_radius. Leaves m_domain unchanged.

◆ SetBezier() [2/2]

bool ON_CurveTreeNode::SetBezier ( int  dim,
bool  is_rat,
int  order,
const double *  cv,
int  stride 
)

◆ Split()

bool ON_CurveTreeNode::Split ( double  s,
ON_CurveTreeNode left_node,
ON_CurveTreeNode right_node 
) const

Description: Expert user tool to split a curve tree node. Does not modify this node's m_down[] pointers or left and right's m_up pointers. Care must be take to guard against memory leaks and double deletes. Parameters: s - [in] normalized (bezier parameter) 0 < s < 1 The corresponding surface domain parameter is m_domain.ParameterAt(s). left_node - [in] node to hold the left half. right_node - [in] node to hold the right half. Returns: True if input is valid and split was performed.

◆ TreeContaining() [1/2]

const ON_CurveTreeNode* ON_CurveTreeNode::TreeContaining ( double  t0,
int  side 
) const

Returns the smallest subtree that contain the given semi-open interval with beginning, (or ending respectively) at t0 when side =0 or 1 ( or side = -1 ). Returns nullptr if range is not contained the domain of this subtree.

◆ TreeContaining() [2/2]

const ON_CurveTreeNode* ON_CurveTreeNode::TreeContaining ( ON_Interval  range) const

Returns the smallest subtree that contain the given interval. Returns nullptr if range is not contained the domain of this subtree.

Member Data Documentation

◆ m_bbox

ON_BoundingBox ON_CurveTreeNode::m_bbox

Bounding box of the portion of the curve with domain [m_domain.Min(), m_domain.Max()]

◆ m_bez

ON_CurveTreeBezier* ON_CurveTreeNode::m_bez

All leaf nodes have a bezier. Non-leaf nodes may have a nullptr here. The domain of m_bez is always [0,1] and m_domain records the portion of the curve that this bezier curve corresponds to.

◆ m_bezmem

unsigned char ON_CurveTreeNode::m_bezmem

0 = do not destroy 1 = destroy with delete 2 = destroy with free

◆ m_domain

ON_Interval ON_CurveTreeNode::m_domain

m_domain records the portion of the curve's domain that this node defines. It is always increasing an included in the curve's domain. The parameters are NURBS form parameters.

◆ m_down

ON_CurveTreeNode* ON_CurveTreeNode::m_down[2]

m_down[] moves towards the leaf nodes. Either both m_down[0] and m_down[1] are nullptr, or both are not nullptr. m_down[0] covers the portion of the curve from m_domain.Min() to m_domain.Mid(). m_down[1] covers the portion of the curve from m_domain.Mid() to m_domain.Max().

◆ m_nodemem

unsigned char ON_CurveTreeNode::m_nodemem

0 = do not destroy 1 = destroy with delete 2 = destroy with free

◆ m_nodesn

unsigned int ON_CurveTreeNode::m_nodesn

serial number of this node

◆ m_nodetype

unsigned char ON_CurveTreeNode::m_nodetype

Memory management accounting information.

8 bits to flag special nodes 1 = root node 2 = meta node (no domain) 4 = reparam

◆ m_reserved_ON_CurveTreeNode

unsigned char ON_CurveTreeNode::m_reserved_ON_CurveTreeNode[5]

keep class size a multiple of 16

◆ m_treesn

unsigned int ON_CurveTreeNode::m_treesn

serial number of this tree

◆ m_up

ON_CurveTreeNode* ON_CurveTreeNode::m_up

m_up moves towards the root node. If m_up is nullptr, the node is the root node.