// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
-#include <Geom2dAPI_InterCurveCurve.ixx>
-#include <Geom2dAdaptor_Curve.hxx>
+#include <Geom2d_Curve.hxx>
#include <Geom2d_TrimmedCurve.hxx>
+#include <Geom2dAdaptor_Curve.hxx>
+#include <Geom2dAPI_InterCurveCurve.hxx>
+#include <Geom2dInt_GInter.hxx>
+#include <gp_Pnt2d.hxx>
#include <IntRes2d_IntersectionPoint.hxx>
#include <IntRes2d_IntersectionSegment.hxx>
-
#include <Standard_NotImplemented.hxx>
-#include <Geom2d_Curve.hxx>
+#include <Standard_NullObject.hxx>
+#include <Standard_OutOfRange.hxx>
//=======================================================================
//function : Geom2dAPI_InterCurveCurve
//purpose :
//=======================================================================
-
Geom2dAPI_InterCurveCurve::Geom2dAPI_InterCurveCurve()
{
myIsDone = Standard_False;
Standard_OutOfRange_Raise_if(theIndex < 1 || theIndex > NbSegments(),
"Geom2dAPI_InterCurveCurve::Segment");
- Standard_NullObject_Raise_if(myCurve1.IsNull() || myCurve2.IsNull(),
+ Standard_NullObject_Raise_if(myCurve1.IsNull(),
"Geom2dAPI_InterCurveCurve::Segment");
- Standard_Real aU1 = myCurve1->FirstParameter(),
- aU2 = myCurve1->LastParameter(),
- aV1 = myCurve2->FirstParameter(),
- aV2 = myCurve2->LastParameter();
+ Standard_Real aU1, aU2, aV1, aV2;
+ aU1 = myCurve1->FirstParameter();
+ aU2 = myCurve1->LastParameter();
+ if (myCurve2.IsNull())
+ {
+ aV1 = aU1;
+ aV2 = aU2;
+ }
+ else
+ {
+ aV1 = myCurve2->FirstParameter();
+ aV2 = myCurve2->LastParameter();
+ }
const IntRes2d_IntersectionSegment& aSeg = myIntersector.Segment(theIndex);
const Standard_Boolean isOpposite = aSeg.IsOpposite();
}
theCurve1 = new Geom2d_TrimmedCurve(myCurve1, aU1, aU2);
- theCurve2 = new Geom2d_TrimmedCurve(myCurve2, aV1, aV2);
-}
-
-//=======================================================================
-//function : Segment
-//purpose :
-//=======================================================================
-
-void Geom2dAPI_InterCurveCurve::Segment (const Standard_Integer Index,
- Handle(Geom2d_Curve)&) const
-{
- Standard_NotImplemented::Raise(" ");
- (void)Index; // avoid compiler warning in Release mode
- Standard_OutOfRange_Raise_if(Index < 0 || Index > NbSegments(),
- "Geom2dAPI_InterCurveCurve::Segment");
+ if (myCurve2.IsNull())
+ theCurve2 = new Geom2d_TrimmedCurve(myCurve1, aV1, aV2);
+ else
+ theCurve2 = new Geom2d_TrimmedCurve(myCurve2, aV1, aV2);
}