1 // Created on: 1995-09-12
2 // Created by: Bruno DUMORTIER
3 // Copyright (c) 1995-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
18 #include <Geom_Curve.hxx>
19 #include <Geom_Surface.hxx>
20 #include <Geom_TrimmedCurve.hxx>
21 #include <GeomAdaptor_HCurve.hxx>
22 #include <GeomAdaptor_HSurface.hxx>
23 #include <GeomAPI_IntCS.hxx>
25 #include <IntCurveSurface_IntersectionPoint.hxx>
26 #include <IntCurveSurface_IntersectionSegment.hxx>
27 #include <Standard_OutOfRange.hxx>
28 #include <StdFail_NotDone.hxx>
30 //=======================================================================
31 //function : GeomAPI_IntCS
33 //=======================================================================
34 GeomAPI_IntCS::GeomAPI_IntCS()
39 //=======================================================================
40 //function : GeomAPI_IntCS
42 //=======================================================================
44 GeomAPI_IntCS::GeomAPI_IntCS(const Handle(Geom_Curve)& C,
45 const Handle(Geom_Surface)& S)
51 //=======================================================================
54 //=======================================================================
56 void GeomAPI_IntCS::Perform(const Handle(Geom_Curve)& C,
57 const Handle(Geom_Surface)& S)
61 Handle(GeomAdaptor_HCurve) HC =
62 new GeomAdaptor_HCurve(C);
63 Handle(GeomAdaptor_HSurface) HS =
64 new GeomAdaptor_HSurface(S);
66 myIntCS.Perform(HC, HS);
70 //=======================================================================
73 //=======================================================================
75 Standard_Boolean GeomAPI_IntCS::IsDone() const
77 return myIntCS.IsDone();
81 //=======================================================================
84 //=======================================================================
86 Standard_Integer GeomAPI_IntCS::NbPoints() const
88 return myIntCS.NbPoints();
92 //=======================================================================
95 //=======================================================================
97 const gp_Pnt& GeomAPI_IntCS::Point(const Standard_Integer Index) const
99 return myIntCS.Point(Index).Pnt();
103 //=======================================================================
104 //function : Parameters
106 //=======================================================================
108 void GeomAPI_IntCS::Parameters(const Standard_Integer Index,
111 Standard_Real& W) const
113 const IntCurveSurface_IntersectionPoint& ThePoint =
114 myIntCS.Point(Index);
122 //=======================================================================
123 //function : NbSegments
125 //=======================================================================
127 Standard_Integer GeomAPI_IntCS::NbSegments() const
129 return myIntCS.NbSegments();
133 //=======================================================================
136 //=======================================================================
138 Handle(Geom_Curve) GeomAPI_IntCS::Segment(const Standard_Integer Index) const
140 const IntCurveSurface_IntersectionPoint& FirstPoint =
141 myIntCS.Segment(Index).FirstPoint();
143 const IntCurveSurface_IntersectionPoint& LastPoint =
144 myIntCS.Segment(Index).SecondPoint();
146 Handle(Geom_TrimmedCurve) TheCurve =
147 new Geom_TrimmedCurve( myCurve, FirstPoint.W(), LastPoint.W());
153 //=======================================================================
154 //function : Parameters
156 //=======================================================================
158 void GeomAPI_IntCS::Parameters(const Standard_Integer Index,
162 Standard_Real& V2) const
164 const IntCurveSurface_IntersectionPoint& FirstPoint =
165 myIntCS.Segment(Index).FirstPoint();
167 const IntCurveSurface_IntersectionPoint& LastPoint =
168 myIntCS.Segment(Index).SecondPoint();