7 #ifndef __geometry_PointCurveNearest_h__ 8 #define __geometry_PointCurveNearest_h__ 24 static T solve(
const Vector<3,T>* a_pVertex,
const U32 a_vertCount,
38 feLog(
"PointCurveNearest< %s >::solve %s radius %.6G\n",
39 FE_TYPESTRING(T).c_str(),
40 c_print(a_origin),a_radius);
41 for(U32 m=0;m<a_vertCount;m++)
43 feLog(
" %d/%d %s\n",m,a_vertCount,c_print(a_pVertex[m]));
55 for(U32 m=0;m<a_vertCount-1;m++)
57 const Vector<3,T> segment=a_pVertex[m+1]-a_pVertex[m];
61 a_radius,a_origin,a_direction,oneAlong,oneIntersection);
62 if(oneMag>=0.0 && (bestMag<0.0 || oneMag<bestMag))
64 const T length=magnitude(segment);
65 bestAlong=oneAlong*(length>0.0? 1.0/length: 1.0);
66 a_intersection=oneIntersection;
72 feLog(
" %d/%d mag %.6G along %.6G at %s\n",m,a_vertCount,
73 oneMag,oneAlong,c_print(oneIntersection));
78 FEASSERT(bestAlong>=0.0);
79 FEASSERT(bestAlong<=1.0);
81 a_along=(bestMag<0.0)? 0.0: (bestIndex+bestAlong)/(a_vertCount-1.0);
84 feLog(
" bestMag %.6G along %.6G \n",bestMag,a_along);
kernel
Definition: namespace.dox:3
Find point nearest to a curve with radius.
Definition: PointCurveNearest.h:21
Find point nearest to a cylindrical solid.
Definition: PointCylinderNearest.h:21