本文整理汇总了C++中ON_Line::Transform方法的典型用法代码示例。如果您正苦于以下问题:C++ ON_Line::Transform方法的具体用法?C++ ON_Line::Transform怎么用?C++ ON_Line::Transform使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ON_Line
的用法示例。
在下文中一共展示了ON_Line::Transform方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Transform
ON_BOOL32 MyUserData::Transform( const ON_Xform& xform )
{
// Optional: call the ON_UserData::Transform() if you want the
// ON_UserData::m_userdata_xform value to be updated.
ON_UserData::Transform(xform);
// Transform any geometry you have in your class.
ON_BOOL32 rc = m_my_line.Transform(xform);
return rc;
}
示例2: ON_Intersect
int ON_Intersect(
const ON_Line& line,
const ON_Circle& circle,
double* line_t0,
ON_3dPoint& circle_point0,
double* line_t1,
ON_3dPoint& circle_point1
)
{
// transform to coordinate system where equation of circle
// is x^2 + y^2 = R^2 and solve for line parameter(s).
ON_Xform xform;
xform.ChangeBasis( circle.plane, ON_xy_plane );
xform.ChangeBasis( ON_xy_plane, circle.plane );
ON_Line L = line;
L.Transform(xform);
double r = fabs(circle.radius);
double tol = r*ON_SQRT_EPSILON;
if ( tol < ON_ZERO_TOLERANCE )
tol = ON_ZERO_TOLERANCE;
int xcnt;
if ( fabs(L.from.x - L.to.x) <= tol
&& fabs(L.from.y - L.to.y) <= tol
&& fabs(L.from.z - L.to.z) > tol )
{
xcnt = 0;
}
else
{
xcnt = Intersect2dLineCircle( L.from, L.to, r, tol, line_t0, line_t1 );
if ( xcnt == 3 )
xcnt = 1;
}
if ( xcnt == 0 )
{
if ( L.ClosestPointTo( circle.Center(), line_t0 ) )
{
xcnt = 1;
*line_t1 = *line_t0;
}
}
ON_3dPoint line_point1, line_point0 = line.PointAt(*line_t0);
circle_point0 = circle.ClosestPointTo(line_point0);
double d1, d0 = line_point0.DistanceTo(circle_point0);
if ( xcnt == 2 )
{
line_point1 = line.PointAt(*line_t1);
circle_point1 = circle.ClosestPointTo(line_point1);
d1 = line_point1.DistanceTo(circle_point1);
}
else
{
line_point1 = line_point0;
circle_point1 = circle_point0;
d1 = d0;
}
if ( xcnt==2 && (d0 > tol && d1 > tol) )
{
xcnt = 1;
if ( d0 <= d1 )
{
*line_t1 = *line_t0;
line_point1 = line_point0;
circle_point1 = circle_point0;
d1 = d0;
}
else
{
*line_t0 = *line_t1;
line_point0 = line_point1;
circle_point0 = circle_point1;
d0 = d1;
}
}
if ( xcnt == 1 && d0 > tol )
{
// TODO: iterate to closest point
}
return xcnt;
}