本文整理汇总了C++中ON_Curve::PointAt方法的典型用法代码示例。如果您正苦于以下问题:C++ ON_Curve::PointAt方法的具体用法?C++ ON_Curve::PointAt怎么用?C++ ON_Curve::PointAt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ON_Curve
的用法示例。
在下文中一共展示了ON_Curve::PointAt方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CalculateTransform
BOOL COrientOnCrvXform::CalculateTransform( CRhinoViewport& vp, const ON_3dPoint& pt, ON_Xform& xform )
{
BOOL bResult = FALSE;
if( m_path_curve )
{
double t = 0.0;
if( m_path_curve->GetClosestPoint(pt, &t) )
{
ON_3dPoint origin = m_path_curve->PointAt( t );
ON_Plane dest_plane;
if( m_perp_mode )
{
ON_3dVector tangent = m_path_curve->TangentAt( t );
MakeNormalPlane( origin, tangent, dest_plane );
}
else
{
dest_plane.origin = origin;
dest_plane.xaxis = m_path_curve->TangentAt( t );
dest_plane.zaxis = m_base_plane.zaxis;
dest_plane.yaxis = ON_CrossProduct( dest_plane.zaxis, dest_plane.xaxis );
dest_plane.UpdateEquation();
}
xform.Rotation( m_base_plane, dest_plane );
bResult = xform.IsValid() ? TRUE : FALSE;
}
}
return bResult;
}
示例2: center
int
main(int, char**)
{
srand(time(0));
ON_3dPoint center(0.0, 0.0, 0.0);
double radius = 10.0;
ON_Sphere sphere(center, radius);
ON_Brep *brep = ON_BrepSphere(sphere);
ON_3dPoint p1(0.0, 0.0, 0.0);
ON_3dPoint p2(0.0, 0.0, radius);
// Point-point intersection
bu_log("*** Point-point intersection ***\n");
test_ppi(p1, p1);
test_ppi(p1, p2);
// Point-curve intersection
bu_log("*** Point-curve intersection ***\n");
// brep->m_C3[0] is an arc curve that starts from (0, 0, -R)
// to (0, 0, R) through (R, 0, 0) which forms a semicircle.
ON_Curve *curve = brep->m_C3[0];
ON_3dPoint mid = curve->PointAt(curve->Domain().Mid());
bu_log("debug: %f %f %f\n", mid[0], mid[1], mid[2]);
bu_log("** Part 1 **\n");
test_pci(p1, *curve);
test_pci(p2, *curve);
// Now we use some randomized points (should intersect)
bu_log("** Part 2 **\n");
for (int i = 0; i < 10; i++) {
double x = rand_f(0.0, radius);
double y = 0.0;
double z = sqrt(radius*radius-x*x);
if (rand() % 2) z = -z; // sometimes we have it negative
ON_3dPoint test_pt(x, y, z);
test_pci(test_pt, *curve);
}
// More randomize points (maybe no intersection)
bu_log("** Part 3 **\n");
for (int i = 0; i < 10; i++) {
// We use test points randomly distributed inside a cube
// from (-R, -R, -R) to (R, R, R)
double x = rand_f(-radius, radius);
double y = rand_f(-radius, radius);
double z = rand_f(-radius, radius);
ON_3dPoint test_pt(x, y, z);
test_pci(test_pt, *curve);
}
// Point-surface intersection
bu_log("*** Point-surface intersection ***\n");
bu_log("** Part 1 **\n");
ON_Surface *surf = brep->m_S[0];
test_psi(p1, *surf);
test_psi(p2, *surf);
// Now we use some randomized points (should intersect)
bu_log("** Part 2 **\n");
for (int i = 0; i < 10; i++) {
double x = rand_f(-radius, radius);
double y_range = sqrt(radius*radius-x*x);
double y = rand_f(-y_range, y_range);
double z = sqrt(y_range*y_range-y*y);
if (rand() % 2) z = -z; // sometimes we have it negative
ON_3dPoint test_pt(x, y, z);
test_psi(test_pt, *surf);
}
// More randomize points (maybe no intersection)
bu_log("** Part 3 **\n");
for (int i = 0; i < 10; i++) {
// We use test points randomly distributed inside a cube
// from (-R, -R, -R) to (R, R, R)
double x = rand_f(-radius, radius);
double y = rand_f(-radius, radius);
double z = rand_f(-radius, radius);
ON_3dPoint test_pt(x, y, z);
test_psi(test_pt, *surf);
}
delete brep;
bu_log("All finished.\n");
return 0;
}