void ON_CurveProxy::SetProxyCurve( const ON_Curve* real_curve, ON_Interval real_curve_subdomain) { if ( real_curve != this ) { // setting m_real_curve=0 prevents crashes if user has deleted // the "real" curve before calling SetProxyCurve(). m_real_curve = 0; DestroyCurveTree(); m_real_curve_domain.Destroy(); m_this_domain.Destroy(); m_bReversed = false; } else { // If you are debugging and end up here, there is a 99% chance // that you passed the wrong pointer to SetProxyCurve(). // However, I will assume you really meant to use a fancy self // reference to adjust domains. if ( IsValid() && m_this_domain.Includes(real_curve_subdomain) ) { real_curve = m_real_curve; // because input real_curve_subdomain was with respect to "this". double r0 = RealCurveParameter(real_curve_subdomain[0]); double r1 = RealCurveParameter(real_curve_subdomain[1]); real_curve_subdomain.Set(r0,r1); } else { real_curve = 0; } // setting m_real_curve=0 prevents crashes if user has deleted // the "real" curve before calling SetProxyCurve(). m_real_curve = 0; DestroyCurveTree(); } m_real_curve = real_curve; if ( m_real_curve ) { SetProxyCurveDomain( real_curve_subdomain ); } else { m_real_curve_domain = real_curve_subdomain; } m_this_domain = m_real_curve_domain; }
// virtual ON_Geometry override bool ON_PolyCurve::Morph( const ON_SpaceMorph& morph ) { DestroyCurveTree(); int segment_count = m_segment.Count(); bool rc = segment_count > 0; if ( rc ) { int i; ON_NurbsCurve* this_seg = 0; for ( i = 0; i < segment_count && rc; i++ ) { if ( 0 == m_segment[i] ) continue; this_seg = ON_NurbsCurve::Cast(m_segment[i]); if ( 0 == this_seg ) { this_seg = m_segment[i]->NurbsCurve(); if ( 0 != this_seg ) { delete m_segment[i]; m_segment[i] = this_seg; } } if ( 0 == this_seg ) rc = false; else rc = this_seg->Morph(morph); } } return rc; }
bool ON_LineCurve::ChangeDimension( int desired_dimension ) { bool rc = (desired_dimension>=2 && desired_dimension<=3); if (rc && m_dim != desired_dimension ) { DestroyCurveTree(); if ( desired_dimension == 2 ) { // 7 April 2003 Dale Lear - zero z coords if x coord are set if( ON_UNSET_VALUE != m_line.from.x ) m_line.from.z = 0.0; if( ON_UNSET_VALUE != m_line.to.x ) m_line.to.z = 0.0; m_dim = 2; } else { if ( 2 == m_dim ) { // 7 April 2003 Dale Lear // zero z coords if x coords are set and z coords are not set if( ON_UNSET_VALUE != m_line.from.x && ON_UNSET_VALUE == m_line.from.z ) m_line.from.z = 0.0; if( ON_UNSET_VALUE != m_line.from.x && ON_UNSET_VALUE == m_line.to.z ) m_line.from.z = 0.0; } m_dim = 3; } } return rc; }
bool ON_LineCurve::Extend( const ON_Interval& domain ) { double len = Domain().Length(); ON_3dVector V = m_line.Direction(); ON_3dPoint Q0 = m_line.from; ON_3dPoint Q1 = m_line.to; double t0 = Domain()[0]; double t1 = Domain()[1]; bool do_it = false; if (domain[1] > Domain()[1]) { Q1 += (domain[1]-Domain()[1])/len*V; t1 = domain[1]; do_it = true; } if (domain[0] < Domain()[0]) { Q0 += (domain[0]-Domain()[0])/len*V; t0 = domain[0]; do_it = true; } if (do_it){ m_line = ON_Line(Q0, Q1); SetDomain(t0, t1); DestroyCurveTree(); } return do_it; }
ON_BOOL32 ON_CurveOnSurface::Transform( const ON_Xform& xform ) { TransformUserData(xform); DestroyCurveTree(); return ( m_s ) ? m_s->Transform(xform) : false; }
bool ON_LineCurve::Morph( const ON_SpaceMorph& morph ) { DestroyCurveTree(); m_line.from = morph.MorphPoint(m_line.from); m_line.to = morph.MorphPoint(m_line.to); return true; }
ON_BOOL32 ON_LineCurve::Transform( const ON_Xform& xform ) { TransformUserData(xform); DestroyCurveTree(); return m_line.Transform( xform ); }
ON_BOOL32 ON_CurveOnSurface::Reverse() { ON_BOOL32 rc = ( m_c2 ) ? m_c2->Reverse() : false; if ( rc && m_c3 ) rc = m_c3->Reverse(); DestroyCurveTree(); return rc; }
ON_BOOL32 ON_LineCurve::Reverse() { const ON_3dPoint p = m_line.from; m_line.from = m_line.to; m_line.to = p; m_t.Reverse(); DestroyCurveTree(); return true; }
ON_BOOL32 ON_LineCurve::Trim( const ON_Interval& domain ) { ON_BOOL32 rc = false; if ( domain.IsIncreasing() ) { DestroyCurveTree(); ON_3dPoint p = PointAt( domain[0] ); ON_3dPoint q = PointAt( domain[1] ); if( p.DistanceTo(q)>0){ // 2 April 2003 Greg Arden A successfull trim // should return an IsValid ON_LineCurve . m_line.from = p; m_line.to = q; m_t = domain; rc = true; } } DestroyCurveTree(); return rc; }
ON_BOOL32 ON_LineCurve::SetDomain( double t0, double t1) { if (t0 < t1) { m_t.Set(t0, t1); DestroyCurveTree(); return true; } return false; }
ON_BOOL32 ON_CurveProxy::SetDomain( double t0, double t1 ) { ON_BOOL32 rc = false; if (t0 < t1) { DestroyCurveTree(); m_this_domain.Set(t0, t1); rc = true; } return rc; }
ON_BOOL32 ON_CurveProxy::Reverse() { if ( m_this_domain.IsIncreasing() ) { m_bReversed = (m_bReversed) ? false : true; DestroyCurveTree(); m_this_domain.Reverse(); } return true; }
void ON_CurveProxy::SetProxyCurve( const ON_Curve* real_curve ) { // setting m_real_curve=0 prevents crashes if user has deleted // the "real" curve before calling SetProxyCurve(). m_real_curve = 0; if ( real_curve ) SetProxyCurve( real_curve, real_curve->Domain() ); else { DestroyCurveTree(); m_real_curve_domain.Destroy(); m_this_domain.Destroy(); m_bReversed = false; } }
bool ON_NurbsCurve::Morph( const ON_SpaceMorph& morph ) { DestroyCurveTree(); ON_BOOL32 bIsClosed = IsClosed(); ON_BOOL32 bIsPeriodic = IsPeriodic(); morph.MorphPointList( m_dim, m_is_rat, m_cv_count, m_cv_stride, m_cv ); if ( bIsPeriodic ) { int i, deg = m_order-1; for ( i = 0; i < deg; i++ ) SetCV( m_cv_count-deg+i, ON::intrinsic_point_style, CV(i) ); } else if ( bIsClosed ) { SetCV( m_cv_count-1, ON::intrinsic_point_style, CV(0) ); } return true; }
bool ON_CurveProxy::SetProxyCurveDomain( ON_Interval proxy_curve_subdomain ) { DestroyCurveTree(); bool rc = proxy_curve_subdomain.IsIncreasing(); if ( rc ) { if ( m_real_curve ) { ON_Interval cdom = m_real_curve->Domain(); cdom.Intersection( proxy_curve_subdomain ); rc = cdom.IsIncreasing(); if (rc ) m_real_curve_domain = cdom; } else { m_real_curve_domain = proxy_curve_subdomain; } } return rc; }
ON_BOOL32 ON_CurveProxy::Trim( const ON_Interval& domain ) { bool rc = false; if ( m_this_domain.IsIncreasing() && m_real_curve_domain.IsIncreasing() ) { ON_Interval trim_dom = m_this_domain; trim_dom.Intersection(domain); if ( trim_dom.IsIncreasing() ) { ON_Interval real_dom = RealCurveInterval( &trim_dom ); if ( real_dom.IsIncreasing() ) { DestroyCurveTree(); m_real_curve_domain = real_dom; m_this_domain = trim_dom; rc = true; } } } return rc; }
ON_BOOL32 ON_LineCurve::SetEndPoint(ON_3dPoint end_point) { m_line.to = end_point; DestroyCurveTree(); return true; }
ON_BOOL32 ON_LineCurve::SetStartPoint(ON_3dPoint start_point) { m_line.from = start_point; DestroyCurveTree(); return true; }
// virtual ON_Geometry override bool ON_PolylineCurve::Morph( const ON_SpaceMorph& morph ) { DestroyCurveTree(); morph.MorphPointList( 3, false, m_pline.Count(), 3, (double*)m_pline.Array() ); return true; }