BRL-CAD
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
brlcad Namespace Reference

Data Structures

class  BBNode
 
class  BRNode
 
class  CurveTree
 
class  SurfaceTree
 

Functions

bool sortX (const BRNode *first, const BRNode *second)
 
bool sortY (const BRNode *first, const BRNode *second)
 
bool get_closest_point (ON_2dPoint &outpt, const ON_BrepFace &face, const ON_3dPoint &point, const SurfaceTree *tree=NULL, double tolerance=BREP_FCP_ROOT_EPSILON)
 
ON_Curve * pullback_curve (ON_BrepFace *face, const ON_Curve *curve, SurfaceTree *tree=NULL, double tolerance=BREP_FCP_ROOT_EPSILON, double flatness=1.0e-3)
 

Function Documentation

◆ sortX()

bool brlcad::sortX ( const BRNode first,
const BRNode second 
)

◆ sortY()

bool brlcad::sortY ( const BRNode first,
const BRNode second 
)

◆ get_closest_point()

bool brlcad::get_closest_point ( ON_2dPoint &  outpt,
const ON_BrepFace &  face,
const ON_3dPoint &  point,
const SurfaceTree tree = NULL,
double  tolerance = BREP_FCP_ROOT_EPSILON 
)

approach:

  • get an estimate using the surface tree (if non-null, create one otherwise)
  • find a point (u, v) for which S(u, v) is closest to point


    – minimize the distance function: D(u, v) = sqrt(|S(u, v)-pt|^2)


    – simplify by minimizing f(u, v) = |S(u, v)-pt|^2

    – minimum occurs when the gradient is zero, i.e.

    \[ \nabla f(u, v) = |\vec{S}(u, v)-\vec{p}|^2 = 0 \]

◆ pullback_curve()

ON_Curve* brlcad::pullback_curve ( ON_BrepFace *  face,
const ON_Curve *  curve,
SurfaceTree tree = NULL,
double  tolerance = BREP_FCP_ROOT_EPSILON,
double  flatness = 1.0e-3 
)

Pull an arbitrary model-space curve onto the given surface as a curve within the surface's domain when, for each point c = C(t) on the curve and the closest point s = S(u, v) on the surface, we have: distance(c, s) <= tolerance.

The resulting 2-dimensional curve will be approximated using the following process:

  1. Adaptively sample the 3d curve in the domain of the surface (ensure tolerance constraint). Sampling terminates when the following flatness criterion is met:

given two parameters on the curve t1 and t2 (which map to points p1 and p2 on the curve) let m be a parameter randomly chosen near the middle of the interval [t1, t2] ____ then the curve between t1 and t2 is flat if distance(C(m), p1p2) < flatness

  1. Use the sampled points to perform a global interpolation using universal knot generation to build a B-Spline curve.
  2. If the curve is a line or an arc (determined with openNURBS routines), return the appropriate ON_Curve subclass (otherwise, return an ON_NurbsCurve).