1 // Copyright (c) 1999-2014 OPEN CASCADE SAS
3 // This file is part of Open CASCADE Technology software library.
5 // This library is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU Lesser General Public License version 2.1 as published
7 // by the Free Software Foundation, with special exception defined in the file
8 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9 // distribution for complete text of the license and disclaimer of any warranty.
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
15 #include <IntTools_Curve.hxx>
16 #include <Geom2d_Curve.hxx>
17 #include <Geom_BoundedCurve.hxx>
18 #include <Geom_Curve.hxx>
19 #include <GeomAdaptor_Curve.hxx>
22 //=======================================================================
23 //function : IntTools_Curve::IntTools_Curve
25 //=======================================================================
26 IntTools_Curve::IntTools_Curve()
29 myTangentialTolerance(0.0)
32 //=======================================================================
33 //function : IntTools_Curve::IntTools_Curve
35 //=======================================================================
36 IntTools_Curve::IntTools_Curve(const Handle(Geom_Curve)& the3dCurve,
37 const Handle(Geom2d_Curve)& the2dCurve1,
38 const Handle(Geom2d_Curve)& the2dCurve2,
39 const Standard_Real theTolerance,
40 const Standard_Real theTangentialTolerance)
42 myTolerance(theTolerance),
43 myTangentialTolerance(theTangentialTolerance)
45 SetCurves(the3dCurve, the2dCurve1, the2dCurve2);
47 //=======================================================================
48 //function : HasBounds
50 //=======================================================================
51 Standard_Boolean IntTools_Curve::HasBounds() const
53 Handle(Geom_BoundedCurve) aC3DBounded =
54 Handle(Geom_BoundedCurve)::DownCast(my3dCurve);
55 Standard_Boolean bIsBounded = !aC3DBounded.IsNull();
59 //=======================================================================
62 //=======================================================================
63 Standard_Boolean IntTools_Curve::Bounds(Standard_Real& theFirst,
64 Standard_Real& theLast,
66 gp_Pnt& theLastPnt) const
68 Standard_Boolean bIsBounded = HasBounds();
70 theFirst = my3dCurve->FirstParameter();
71 theLast = my3dCurve->LastParameter();
72 my3dCurve->D0(theFirst, theFirstPnt);
73 my3dCurve->D0(theLast, theLastPnt);
78 //=======================================================================
81 //=======================================================================
82 Standard_Boolean IntTools_Curve::D0(const Standard_Real& thePar,
85 Standard_Boolean bInside = !(thePar < my3dCurve->FirstParameter() &&
86 thePar > my3dCurve->LastParameter());
88 my3dCurve->D0(thePar, thePnt);
93 //=======================================================================
96 //=======================================================================
97 GeomAbs_CurveType IntTools_Curve::Type() const
99 GeomAdaptor_Curve aGAC(my3dCurve);
100 GeomAbs_CurveType aType = aGAC.GetType();