Rhino C++ API  8.6
Public Member Functions | Public Attributes | List of all members
ON_SurfaceTreeNode Class Reference

#include <opennurbs_plus.h>

Inheritance diagram for ON_SurfaceTreeNode:
ON_SurfaceTree

Public Member Functions

 ON_SurfaceTreeNode ()
 
 ~ON_SurfaceTreeNode ()
 
bool AdjustParameter () const
 
ON_SurfaceTreeNodeEastNode () const
 
const ON_SurfaceTreeNodeEvaluate (double s, double t, int der_count, int v_stride, double *v, int quadrant=0) const
 
const ON_SurfaceTreeNodeFindLeaf (double s, double t, int quadrant=0) const
 
const ON_SurfaceTreeNodeGetClosestPoint (ON_3dPoint P, double *s, double *t, ON_3dPoint *closestpt=0, double maximum_distance=0.0, const ON_Interval *sdomain=0, const ON_Interval *tdomain=0) const
 
int IntersectSurface (const class ON_SurfaceTreeNode *snodeB, ON_ClassArray< ON_SSX_EVENT > &x, double intersection_tolerance=0.0, double overlap_tolerance=0.0, double fitting_tolerance=0.0, const ON_Interval *surfaceA_udomain=0, const ON_Interval *surfaceA_vdomain=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_SurfaceTreeNode *other) const
 
bool IsNearSingularity (double s0, double s1) const
 
bool IsNearSingularity (double s0, double s1, int &side, double tol=1e-5) const
 
bool IsValid (ON_TextLog *text_log=0, int level=0, int side=-1, const class ON_Surface *surface=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_SurfaceTreeNodeNextLeaf () const
 
ON_SurfaceTreeNodeNorthNode () const
 
ON_SurfaceTreeNodePrevLeaf () const
 
ON_SurfaceTreeNodeSouthNode () const
 
bool Split (int dir, double s, ON_SurfaceTreeNode &left_node, ON_SurfaceTreeNode &right_node) const
 
int SplitDir () const
 
ON_SurfaceTreeNodeTreeContaining (const ON_Interval &Urange, const ON_Interval &Vrange) const
 
ON_SurfaceTreeNodeWestNode () const
 

Public Attributes

ON_BoundingBox m_bbox
 
ON_SurfaceTreeBezierm_bez
 
unsigned char m_bezmem
 
ON_Interval m_domain [2]
 
ON_SurfaceTreeNodem_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_SurfaceTreeNode [5]
 keep sizeof() a multiple of 16 More...
 
unsigned int m_treesn
 serial number of this tree More...
 
ON_SurfaceTreeNodem_up
 

Detailed Description

A surface tree is a simple binary tree of bezier surfaces and is used to speed up geometric calculations.

Constructor & Destructor Documentation

◆ ON_SurfaceTreeNode()

ON_SurfaceTreeNode::ON_SurfaceTreeNode ( )

◆ ~ON_SurfaceTreeNode()

ON_SurfaceTreeNode::~ON_SurfaceTreeNode ( )

Member Function Documentation

◆ AdjustParameter()

bool ON_SurfaceTreeNode::AdjustParameter ( ) const

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

◆ EastNode()

ON_SurfaceTreeNode* ON_SurfaceTreeNode::EastNode ( ) const

◆ Evaluate()

const ON_SurfaceTreeNode* ON_SurfaceTreeNode::Evaluate ( double  s,
double  t,
int  der_count,
int  v_stride,
double *  v,
int  quadrant = 0 
) const

Description: Evaluate the portion of the surfac covered by this node. Parameters: s - [in] t - [in] (s,t) - evaluation parameters with respect to this 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 surface(s,t) is returned in (v[0],...,v[m_dim-1]), Ds is returned in (v[v_stride],...,v[v_stride+m_dim-1]), Dt is returned in (v[2*v_stride],...,v[2*v_stride+m_dim-1]), Dss is returned in (v[3*v_stride],...), Dst is returned in (v[4*v_stride],...), Dtt is returned in (v[5*v_stride],...), etc. quadrant - [in] optional - 1,2,3 or 4 Determines which quadrant to evaluate from when (s,t) is on the side of a leaf node. Values < 1 or > 4 are treated as 1 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 (s,t) is out outside this node's domain, the bezier on the appropriate side is evaluated.

◆ FindLeaf()

const ON_SurfaceTreeNode* ON_SurfaceTreeNode::FindLeaf ( double  s,
double  t,
int  quadrant = 0 
) const

Description: Starting at this node, find the leaf node whose domain contains that parameter (s,t). Parameters: t - [in] quadrant - [in] optional - 1,2,3 or 4 Determines which quadrant to use from when (s,t) is on the side of a leaf node. Values < 1 or > 4 are treated as 1 Returns: Pointer to the node that contains (s,t). If (s,t) is outside this node's domain, then the leaf closest to (s,t) is returned.

◆ GetClosestPoint()

const ON_SurfaceTreeNode* ON_SurfaceTreeNode::GetClosestPoint ( ON_3dPoint  P,
double *  s,
double *  t,
ON_3dPoint closestpt = 0,
double  maximum_distance = 0.0,
const ON_Interval sdomain = 0,
const ON_Interval tdomain = 0 
) const

◆ IntersectSurface()

int ON_SurfaceTreeNode::IntersectSurface ( const class ON_SurfaceTreeNode snodeB,
ON_ClassArray< ON_SSX_EVENT > &  x,
double  intersection_tolerance = 0.0,
double  overlap_tolerance = 0.0,
double  fitting_tolerance = 0.0,
const ON_Interval surfaceA_udomain = 0,
const ON_Interval surfaceA_vdomain = 0,
const ON_Interval surfaceB_udomain = 0,
const ON_Interval surfaceB_vdomain = 0 
) const

◆ IsFartherThan() [1/3]

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

Description: Quickly determine if the shortest distance from the portion of the surface covered by this node to the other object is greater than d. Parameters: d - [in] distance (> 0.0) P - [in] other - [in] Returns: True if if the shortest distance from this node to the other object is greater than d. Put another way, true if returned if for every point Q on the portion of the surface covered by this node and for every point P on the other object Q.DistanceTo(P) > d. Remarks: This is conceptually the same but faster than calling MinimumDistanceUpperBound(other) > d.

◆ IsFartherThan() [2/3]

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

◆ IsFartherThan() [3/3]

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

◆ IsNearSingularity() [1/2]

bool ON_SurfaceTreeNode::IsNearSingularity ( double  s0,
double  s1 
) const

Description: Test normalized span parameters to see if they are near a singularity. Parameters: s0 - [in] 0 <= s1 <= 1 s1 - [in] 0 <= s1 <= 1 side - [out] If true south, 1 = east, 2 = north, 3 = west tolerance of normalized parameter Returns: True if the parameters are near a singularity.

◆ IsNearSingularity() [2/2]

bool ON_SurfaceTreeNode::IsNearSingularity ( double  s0,
double  s1,
int &  side,
double  tol = 1e-5 
) const

◆ IsValid()

bool ON_SurfaceTreeNode::IsValid ( ON_TextLog text_log = 0,
int  level = 0,
int  side = -1,
const class ON_Surface surface = 0 
) const

◆ MaximumDistanceUpperBound() [1/3]

double ON_SurfaceTreeNode::MaximumDistanceUpperBound ( const ON_CurveTreeNode other) const

◆ MaximumDistanceUpperBound() [2/3]

double ON_SurfaceTreeNode::MaximumDistanceUpperBound ( const ON_SurfaceTreeNode other) const

◆ MaximumDistanceUpperBound() [3/3]

double ON_SurfaceTreeNode::MaximumDistanceUpperBound ( ON_3dPoint  P) const

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

◆ MinimumDistanceLowerBound() [1/3]

double ON_SurfaceTreeNode::MinimumDistanceLowerBound ( const ON_CurveTreeNode other) const

◆ MinimumDistanceLowerBound() [2/3]

double ON_SurfaceTreeNode::MinimumDistanceLowerBound ( const ON_SurfaceTreeNode other) const

◆ MinimumDistanceLowerBound() [3/3]

double ON_SurfaceTreeNode::MinimumDistanceLowerBound ( ON_3dPoint  P) const

Description: Quickly find a lower 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 less than or equal to the shortest 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) >= MinimumDistanceTo(P);

◆ MinimumDistanceUpperBound() [1/3]

double ON_SurfaceTreeNode::MinimumDistanceUpperBound ( const ON_CurveTreeNode other) const

◆ MinimumDistanceUpperBound() [2/3]

double ON_SurfaceTreeNode::MinimumDistanceUpperBound ( const ON_SurfaceTreeNode other) const

◆ MinimumDistanceUpperBound() [3/3]

double ON_SurfaceTreeNode::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 surface node to the other object. Put another way, there exists a point Q on the portion of the surface covered by this node and a point P on the other object such that P.DistanceTo(Q) <= MinimumDistanceUpperBound();

◆ NextLeaf()

ON_SurfaceTreeNode* ON_SurfaceTreeNode::NextLeaf ( ) const

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

◆ NorthNode()

ON_SurfaceTreeNode* ON_SurfaceTreeNode::NorthNode ( ) const

For any SurfaceTreeNode, not just leafs, the NorthNode(), SouthNode(), EastNode() and WestNode() functions returns a pointer to the SurfaceTreeNode of the neighboring region. For example, for any SurfaceTreeNode N with non-null N.NorthNode() we have the relations N.NorthNode()->Domain[0].Includes( N.Domain[0] ) and N.NorthNode()->Domain[1][0] == N.Domain[1][1] Remark: The periodicity of the surface is not considered. So for example every surface has a northern most leaf for which NorthSide() will return nullptr.

◆ PrevLeaf()

ON_SurfaceTreeNode* ON_SurfaceTreeNode::PrevLeaf ( ) const

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

◆ SouthNode()

ON_SurfaceTreeNode* ON_SurfaceTreeNode::SouthNode ( ) const

◆ Split()

bool ON_SurfaceTreeNode::Split ( int  dir,
double  s,
ON_SurfaceTreeNode left_node,
ON_SurfaceTreeNode right_node 
) const

Description: Expert user tool to split a surface tree node. Does not modify this node's m_down[] pointers or left and right's m_up pointers. Care must be take to gaurd against memory leaks and double deletes. Parameters: dir - [in] 0 = split first parameter direction 1 = split second parameter direction s - [in] normalized (bezier parameter) 0 < s < 1 The corresponding surface domain parameter is m_domain[dir].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.

◆ SplitDir()

int ON_SurfaceTreeNode::SplitDir ( ) const

Description: Reports the direction this node was split or would be split. Parameters: Returns: 0: the node was split in the "u" direction 1: the node was split in the "v" direction -1: otherwise

◆ TreeContaining()

ON_SurfaceTreeNode* ON_SurfaceTreeNode::TreeContaining ( const ON_Interval Urange,
const ON_Interval Vrange 
) const

Description: Find the smallest node that contains the specified parameter range. Parameters: Urange - [in] Vrange - [in] Returns: A pointer to the smallest child node (possibly this) that contains the specified parameter range or nullptr if no such node exists.

◆ WestNode()

ON_SurfaceTreeNode* ON_SurfaceTreeNode::WestNode ( ) const

Member Data Documentation

◆ m_bbox

ON_BoundingBox ON_SurfaceTreeNode::m_bbox

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

◆ m_bez

ON_SurfaceTreeBezier* ON_SurfaceTreeNode::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]x[0,1] and m_domain[] records the portion of the surface that this bezier surface corresponds to.

◆ m_bezmem

unsigned char ON_SurfaceTreeNode::m_bezmem

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

◆ m_domain

ON_Interval ON_SurfaceTreeNode::m_domain[2]

m_domain records the portion of the surface's domain that this node defines. It is always increasing.

◆ m_down

ON_SurfaceTreeNode* ON_SurfaceTreeNode::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. If m_split_dir=0, m_domain is partitioned into a left portion m_down[0]->m_domain and a right portion m_down[1]->m_domain. If m_split_dir=1 m_domain is partitioned into a lower portion m_down[0]->m_domain and an upper portion m_down[1]->m_domain.

◆ m_nodemem

unsigned char ON_SurfaceTreeNode::m_nodemem

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

◆ m_nodesn

unsigned int ON_SurfaceTreeNode::m_nodesn

serial number of this node

◆ m_nodetype

unsigned char ON_SurfaceTreeNode::m_nodetype

Memory management accounting information.

8 bits to flag special nodes 1 = root node 2 = meta node (no domain) 4 = beizer parameterization != surface parameterization 8 = south side is singular point 16 = east side is singular point 32 = north side is singular point 64 = west side is singular point

◆ m_reserved_ON_SurfaceTreeNode

unsigned char ON_SurfaceTreeNode::m_reserved_ON_SurfaceTreeNode[5]

keep sizeof() a multiple of 16

◆ m_treesn

unsigned int ON_SurfaceTreeNode::m_treesn

serial number of this tree

◆ m_up

ON_SurfaceTreeNode* ON_SurfaceTreeNode::m_up

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