本文整理汇总了C++中ON_Curve类的典型用法代码示例。如果您正苦于以下问题:C++ ON_Curve类的具体用法?C++ ON_Curve怎么用?C++ ON_Curve使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ON_Curve类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ON_Brep_DuplicateEdgeCurves
RH_C_FUNCTION void ON_Brep_DuplicateEdgeCurves(const ON_Brep* pBrep, ON_SimpleArray<ON_Curve*>* pOutCurves, bool nakedOnly)
{
if (pBrep && pOutCurves)
{
for(int i = 0; i < pBrep->m_E.Count(); i++)
{
const ON_BrepEdge& edge = pBrep->m_E[i];
if( nakedOnly && edge.m_ti.Count()!=1 )
continue;
ON_Curve* curve = edge.DuplicateCurve();
if(curve)
{
// From RhinoScript:
// make the curve direction go in the natural boundary loop direction
// so that the curve directions come out consistantly
if( pBrep->m_T[edge.m_ti[0]].m_bRev3d )
curve->Reverse();
if( pBrep->m_T[edge.m_ti[0]].Face()->m_bRev )
curve->Reverse();
pOutCurves->Append(curve);
}
}
}
}
示例2: Pushup
ON_Curve* ON_SurfaceProxy::Pushup( const ON_Curve& curve_2d,
double tolerance,
const ON_Interval* curve_2d_subdomain
) const
{
ON_Curve* pushupcurve = 0;
if ( 0 != m_surface )
{
if ( m_bTransposed )
{
ON_Curve* transposedcurve = curve_2d.DuplicateCurve();
if ( 0 != transposedcurve )
{
transposedcurve->SwapCoordinates(0,1);
pushupcurve = m_surface->Pushup( *transposedcurve, tolerance, curve_2d_subdomain );
delete transposedcurve;
transposedcurve = 0;
}
}
else
{
pushupcurve = m_surface->Pushup( curve_2d, tolerance, curve_2d_subdomain );
}
}
return pushupcurve;
}
示例3: UnrotateHatch
static void UnrotateHatch(ON_Hatch* hatch)
{
double a = arbaxisRotation(hatch->Plane());
ON_Plane& plane = *(ON_Plane*)(&hatch->Plane());
if(fabs(a) > ON_ZERO_TOLERANCE)
{
plane.Rotate(-a, plane.zaxis);
for(int i = 0; i < hatch->LoopCount(); i++)
{
ON_Curve* pC = (ON_Curve*)hatch->Loop(i)->Curve();
pC->Rotate(a, ON_zaxis, ON_origin);
}
hatch->SetPatternRotation(hatch->PatternRotation()+a);
}
ON_3dPoint P;
plane.ClosestPointTo(ON_origin, &P.x, &P.y);
if(fabs(P.x) > ON_ZERO_TOLERANCE ||fabs(P.y) > ON_ZERO_TOLERANCE ||fabs(P.z) > ON_ZERO_TOLERANCE)
{
ON_2dVector V(-P.x, -P.y);
for(int i = 0; i < hatch->LoopCount(); i++)
{
ON_Curve* pC = (ON_Curve*)hatch->Loop(i)->Curve();
pC->Translate(V);
}
P = plane.PointAt(P.x, P.y);
plane.origin = P;
}
}
示例4: ON_BrepExtrudeHelper_CheckPathCurve
static
bool ON_BrepExtrudeHelper_CheckPathCurve( const ON_Curve& path_curve, ON_3dVector& path_vector )
{
ON_Line path_line;
path_line.from = path_curve.PointAtStart();
path_line.to = path_curve.PointAtEnd();
path_vector = path_line.Direction();
return ( path_vector.IsZero() ? false : true );
}
示例5: ON_Hatch_AreaMassProperties
RH_C_FUNCTION ON_MassProperties* ON_Hatch_AreaMassProperties(const ON_Hatch* pConstHatch, double rel_tol, double abs_tol)
{
ON_MassProperties* rc = NULL;
if( pConstHatch )
{
ON_BoundingBox bbox = pConstHatch->BoundingBox();
ON_3dPoint basepoint = bbox.Center();
basepoint = pConstHatch->Plane().ClosestPointTo(basepoint);
ON_ClassArray<ON_MassProperties> list;
for( int i=0; i<pConstHatch->LoopCount(); i++ )
{
const ON_HatchLoop* pLoop = pConstHatch->Loop(i);
if( NULL==pLoop )
continue;
ON_Curve* pCurve = pConstHatch->LoopCurve3d(i);
if( NULL==pCurve )
continue;
ON_MassProperties mp;
if( pCurve->AreaMassProperties(basepoint, pConstHatch->Plane().Normal(), mp, true, true, true, true, rel_tol, abs_tol) )
{
mp.m_mass = fabs(mp.m_mass);
if( pLoop->Type() == ON_HatchLoop::ltInner )
mp.m_mass = -mp.m_mass;
list.Append(mp);
}
delete pCurve;
}
if( list.Count()==1 )
{
rc = new ON_MassProperties();
*rc = list[0];
}
else if( list.Count()>1 )
{
int count = list.Count();
const ON_MassProperties* pieces = list.Array();
rc = new ON_MassProperties();
if( !rc->Sum(count, pieces) )
{
delete rc;
rc = NULL;
}
}
}
return rc;
}
示例6: SetCurve
bool ON_HatchLoop::SetCurve( const ON_Curve& curve)
{
ON_Curve* pC = curve.DuplicateCurve();
if( pC)
{
if(pC->Dimension() == 3 && !pC->ChangeDimension(2))
return false;
if( m_p2dCurve)
delete m_p2dCurve;
m_p2dCurve = pC;
}
return true;
}
示例7: switch
ON_Surface::ISO
ON_SurfaceProxy::IsIsoparametric( // returns isoparametric status of 2d curve
const ON_Curve& crv,
const ON_Interval* subdomain
) const
{
// this is a virtual overide of an ON_Surface::IsIsoparametric
const ON_Curve* pC = &crv;
ON_Curve* pTranC = NULL;
if(m_bTransposed)
{
pTranC = crv.DuplicateCurve();
pTranC->SwapCoordinates(0,1);
pC = pTranC;
}
ON_Surface::ISO iso = m_surface->IsIsoparametric( *pC, subdomain);
if (pTranC)
{
switch(iso)
{
case x_iso:
iso = y_iso;
break;
case y_iso:
iso = x_iso;
break;
case W_iso:
iso = S_iso;
break;
case S_iso:
iso = W_iso;
break;
case N_iso:
iso = E_iso;
break;
case E_iso:
iso = N_iso;
break;
default:
// intentionally ignoring other ON_Surface::ISO enum values
break;
}
delete pTranC;
}
return iso;
}
示例8: GetBBox
BOOL ON_Hatch::GetBBox( double* bmin, double* bmax, BOOL bGrowBox) const
{
int i;
int count = m_loops.Count();
BOOL rc = true;
ON_Curve* pC;
for( i = 0; rc && i < count; i++)
{
pC = LoopCurve3d( i);
if( pC)
{
rc = pC->GetBBox( bmin, bmax, i?true:bGrowBox);
delete pC;
}
}
return rc;
}
示例9: defined
void ON_CurveProxy::DestroyRuntimeCache( bool bDelete )
{
if ( m_ctree )
{
#if defined(OPENNURBS_PLUS_INC_)
if ( bDelete )
delete m_ctree;
#endif
m_ctree = 0;
}
if ( 0 != m_real_curve && m_real_curve != this )
{
ON_Curve* curve = const_cast<ON_Curve*>(m_real_curve);
if ( 0 != curve )
curve->DestroyRuntimeCache( bDelete );
}
}
示例10: Pullback
ON_Curve* ON_SurfaceProxy::Pullback( const ON_Curve& curve_3d,
double tolerance,
const ON_Interval* curve_3d_subdomain,
ON_3dPoint start_uv,
ON_3dPoint end_uv
) const
{
ON_Curve* pullbackcurve = 0;
if ( 0 != m_surface )
{
pullbackcurve = m_surface->Pullback( curve_3d, tolerance, curve_3d_subdomain, start_uv, end_uv );
if ( m_bTransposed && 0 != pullbackcurve )
{
pullbackcurve->SwapCoordinates(0,1);
}
}
return pullbackcurve;
}
示例11: SetCurve
bool ON_HatchLoop::SetCurve( const ON_Curve& curve)
{
ON_Curve* pC = curve.DuplicateCurve();
if( pC)
{
if( m_p2dCurve)
delete m_p2dCurve;
m_p2dCurve = pC;
}
return true;
}
示例12:
// Copy the 2d curve, make it 3d, and transform it
// to the 3d plane position
ON_Curve* ON_Hatch::LoopCurve3d( int index) const
{
int count = m_loops.Count();
ON_Curve* pC = NULL;
if( index >= 0 && index < count)
{
if( m_loops[index]->Curve())
{
pC = m_loops[index]->Curve()->DuplicateCurve();
if( pC)
{
pC->ChangeDimension( 3);
ON_Xform xf;
xf.Rotation( ON_xy_plane, m_plane);
pC->Transform( xf);
}
}
}
return pC;
}
示例13: ON_Curve_TrimExtend
RH_C_FUNCTION ON_Curve* ON_Curve_TrimExtend( const ON_Curve* pCurve, double t0, double t1, bool trimming)
{
ON_Curve* rc = NULL;
if( pCurve )
{
if( trimming )
{
rc = ::ON_TrimCurve(*pCurve, ON_Interval(t0,t1));
}
else
{
ON_Curve* pNewCurve = pCurve->DuplicateCurve();
if( pNewCurve )
{
if( pNewCurve->Extend(ON_Interval(t0,t1)) )
rc = pNewCurve;
else
delete pNewCurve;
}
}
}
return rc;
}
示例14: ON_Brep_DuplicateEdgeCurves
RH_C_FUNCTION void ON_Brep_DuplicateEdgeCurves(const ON_Brep* pConstBrep, ON_SimpleArray<ON_Curve*>* pOutCurves, bool nakedOnly, bool nakedOuter, bool nakedInner)
{
if (pConstBrep && pOutCurves)
{
for(int i = 0; i < pConstBrep->m_E.Count(); i++)
{
const ON_BrepEdge& edge = pConstBrep->m_E[i];
if( nakedOnly )
{
if( edge.m_ti.Count() != 1 )
continue;
const ON_BrepTrim& trim = pConstBrep->m_T[edge.m_ti[0]];
const ON_BrepLoop& loop = pConstBrep->m_L[trim.m_li];
bool acceptable = (nakedOuter && loop.m_type == ON_BrepLoop::outer) ||
(nakedInner && loop.m_type == ON_BrepLoop::inner);
if( !acceptable )
continue;
}
ON_Curve* curve = edge.DuplicateCurve();
if(curve)
{
// From RhinoScript:
// make the curve direction go in the natural boundary loop direction
// so that the curve directions come out consistantly
if( pConstBrep->m_T[edge.m_ti[0]].m_bRev3d )
curve->Reverse();
if( pConstBrep->m_T[edge.m_ti[0]].Face()->m_bRev )
curve->Reverse();
pOutCurves->Append(curve);
}
}
}
}
示例15: ON_Brep_GetTightCurveBoundingBox_Helper
// Add a curve to the partial boundingbox result.
static void ON_Brep_GetTightCurveBoundingBox_Helper( const ON_Curve& crv, ON_BoundingBox& bbox, const ON_Xform* xform, const ON_Xform* xform_inverse )
{
// Get loose boundingbox of curve.
ON_BoundingBox tempbox;
if( !crv.GetBoundingBox(tempbox, false) )
return;
// Transform the loose box if necessary.
// Note: transforming a box might result in a larger box,
// it's better to transform the curve,
// which might actually result in a smaller box.
if( xform_inverse )
{
tempbox.Transform(*xform_inverse);
}
// If loose boundingbox of curve is inside partial result, return.
if( bbox.Includes(tempbox, false) )
return;
// Get tight boundingbox of curve, grow partial result.
if( crv.GetTightBoundingBox(tempbox, false, xform) )
bbox.Union(tempbox);
}