BRL-CAD
|
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) |
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:
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 \]
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:
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