diff --git a/opennurbs_curve.cpp b/opennurbs_curve.cpp index 3e82a01..46de1b9 100644 --- a/opennurbs_curve.cpp +++ b/opennurbs_curve.cpp @@ -1413,11 +1413,11 @@ bool ON_Curve::Ev2Der( // returns false if unable to evaluate // -static -ON::eCurveType ON_CurveType( const ON_Curve* curve ) +ON::eCurveType ON_Curve::ON_CurveType() const { const ON_ClassId* curve_id = &ON_CLASS_RTTI(ON_Curve); - const ON_ClassId* id = curve->ClassId(); + + const ON_ClassId* id = this->ClassId(); // "fake virtual" handling of fast/easy special cases while (0 != id && curve_id != id ) @@ -1496,7 +1496,7 @@ bool ON_MatchCurveEnds( ON_Curve* curve0, ON_3dPoint Q0 = ON_3dPoint::UnsetPoint; ON_3dPoint Q1 = ON_3dPoint::UnsetPoint; ON_Curve* c = i ? curve1 : curve0; - ON::eCurveType ct = ON_CurveType(c); + ON::eCurveType ct = c->ON_CurveType(); int e = i ? end1 : end0; while ( ON::ctPolycurve == ct ) { @@ -1507,7 +1507,7 @@ bool ON_MatchCurveEnds( ON_Curve* curve0, c = polycurve->SegmentCurve(e?(polycurve->Count()-1):0); if( 0 == c ) return false; - ct = ON_CurveType(c); + ct = c->ON_CurveType(); } seg[i] = c; switch(ct) @@ -1714,7 +1714,7 @@ bool ON_ForceMatchCurveEnds(ON_Curve& Crv0, int end0, ON_Curve& Crv1, int end1) for ( i = 0; i<2; i++ ) { ON_Curve* c = i ? &Crv1 : &Crv0; - ct[i] = ON_CurveType(c); + ct[i] = c->ON_CurveType(); int e = i ? end1 : end0; while ( ON::ctPolycurve == ct[i] ) { @@ -1725,7 +1725,7 @@ bool ON_ForceMatchCurveEnds(ON_Curve& Crv0, int end0, ON_Curve& Crv1, int end1) c = polycurve->SegmentCurve(e?(polycurve->Count()-1):0); if( 0 == c ) return false; - ct[i] = ON_CurveType(c); + ct[i] = c->ON_CurveType(); } if (c->IsClosed()) return false; @@ -1778,7 +1778,7 @@ bool ON_ForceMatchCurveEnds(ON_Curve& Crv0, int end0, ON_Curve& Crv1, int end1) else { //23 Jan 2018 - Chuck - If yanking a polycurve segment at the join causes //that seg to be tiny, remove it and try again. See RH-43661 - if (ON_CurveType(&Crv0) == ON::ctPolycurve){ + if (Crv0.ON_CurveType() == ON::ctPolycurve){ ON_PolyCurve* polycurve = ON_PolyCurve::Cast(&Crv0); if (polycurve->Count() > 1 && FastIsShort(*seg[0], 10.0*ON_ZERO_TOLERANCE)) bTryAgain = (end0) ? polycurve->Remove() : polycurve->Remove(0); @@ -1792,7 +1792,7 @@ bool ON_ForceMatchCurveEnds(ON_Curve& Crv0, int end0, ON_Curve& Crv1, int end1) else { //23 Jan 2018 - Chuck - If yanking a polycurve segment at the join causes //that seg to be tiny, remove it and try again. See RH-43661 - if (ON_CurveType(&Crv1) == ON::ctPolycurve){ + if (Crv1.ON_CurveType() == ON::ctPolycurve){ ON_PolyCurve* polycurve = ON_PolyCurve::Cast(&Crv1); if (polycurve->Count() > 1 && FastIsShort(*seg[1], 10.0*ON_ZERO_TOLERANCE)){ bool bRem = (end1) ? polycurve->Remove() : polycurve->Remove(0); diff --git a/opennurbs_curve.h b/opennurbs_curve.h index efe9a68..188ae3c 100644 --- a/opennurbs_curve.h +++ b/opennurbs_curve.h @@ -140,6 +140,8 @@ public: // ON::curve_object ON::object_type ObjectType() const override; + ON::eCurveType ON_Curve::ON_CurveType() const ; + // virtual ON_Geometry GetTightBoundingBox override bool GetTightBoundingBox( class ON_BoundingBox& tight_bbox, bool bGrowBox = false, const class ON_Xform* xform = nullptr ) const override;