1 // Copyright (C) 2015-2024 CEA, EDF, OPEN CASCADE
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 #include <GEOMUtils_TrsfCurve2d.hxx>
23 #include <Geom2d_BezierCurve.hxx>
24 #include <Geom2d_BSplineCurve.hxx>
26 #if OCC_VERSION_LARGE < 0x07070000
27 #include <GEOMUtils_HTrsfCurve2d.hxx>
29 IMPLEMENT_STANDARD_RTTIEXT(GEOMUtils::TrsfCurve2d, Adaptor2d_Curve2d)
32 //=======================================================================
33 //function : TrsfCurve2d
35 //=======================================================================
36 GEOMUtils::TrsfCurve2d::TrsfCurve2d(const Handle(Geom2d_Curve) &theCurve,
37 const Trsf2d &theTrsf)
43 //=======================================================================
44 //function : TrsfCurve2d
46 //=======================================================================
47 GEOMUtils::TrsfCurve2d::TrsfCurve2d(const Handle(Geom2d_Curve) &theCurve,
48 const Standard_Real theUFirst,
49 const Standard_Real theULast,
50 const Trsf2d &theTrsf)
51 : myCurve (theCurve, theUFirst, theULast),
56 //=======================================================================
57 //function : FirstParameter
59 //=======================================================================
60 Standard_Real GEOMUtils::TrsfCurve2d::FirstParameter() const
62 return myCurve.FirstParameter();
65 //=======================================================================
66 //function : LastParameter
68 //=======================================================================
69 Standard_Real GEOMUtils::TrsfCurve2d::LastParameter() const
71 return myCurve.LastParameter();
74 //=======================================================================
77 //=======================================================================
78 const Handle(Geom2d_Curve) &GEOMUtils::TrsfCurve2d::Curve() const
80 return myCurve.Curve();
83 //=======================================================================
86 //=======================================================================
87 GeomAbs_CurveType GEOMUtils::TrsfCurve2d::GetType() const
89 return GeomAbs_OtherCurve;
92 //=======================================================================
95 //=======================================================================
96 void GEOMUtils::TrsfCurve2d::Load(const Handle(Geom2d_Curve) &C)
101 //=======================================================================
104 //=======================================================================
105 void GEOMUtils::TrsfCurve2d::Load(const Handle(Geom2d_Curve) &C,
106 const Standard_Real UFirst,
107 const Standard_Real ULast)
109 myCurve.Load(C, UFirst, ULast);
112 //=======================================================================
113 //function : Continuity
115 //=======================================================================
116 GeomAbs_Shape GEOMUtils::TrsfCurve2d::Continuity() const
118 return myCurve.Continuity();
121 //=======================================================================
122 //function : NbIntervals
124 //=======================================================================
125 Standard_Integer GEOMUtils::TrsfCurve2d::NbIntervals
126 (const GeomAbs_Shape S) const
128 return myCurve.NbIntervals(S);
131 //=======================================================================
132 //function : Intervals
134 //=======================================================================
135 void GEOMUtils::TrsfCurve2d::Intervals(TColStd_Array1OfReal &T,
136 const GeomAbs_Shape S) const
138 myCurve.Intervals(T, S);
141 //=======================================================================
144 //=======================================================================
145 #if OCC_VERSION_LARGE < 0x07070000
146 Handle(Adaptor2d_HCurve2d) GEOMUtils::TrsfCurve2d::Trim
147 (const Standard_Real First, const Standard_Real Last,
148 const Standard_Real /*Tol*/) const
150 Handle(Geom2d_Curve) aCurve = myCurve.Curve();
151 Handle(GEOMUtils::HTrsfCurve2d) aAHCurve =
152 new GEOMUtils::HTrsfCurve2d(aCurve, First, Last, myTrsf);
157 Handle(Adaptor2d_Curve2d) GEOMUtils::TrsfCurve2d::Trim
158 (const Standard_Real First, const Standard_Real Last,
159 const Standard_Real /*Tol*/) const
161 Handle(Geom2d_Curve) aCurve = myCurve.Curve();
162 Handle(GEOMUtils::TrsfCurve2d) aAHCurve =
163 new GEOMUtils::TrsfCurve2d(aCurve, First, Last, myTrsf);
169 //=======================================================================
170 //function : IsClosed
172 //=======================================================================
173 Standard_Boolean GEOMUtils::TrsfCurve2d::IsClosed() const
175 return myCurve.IsClosed();
178 //=======================================================================
179 //function : IsPeriodic
181 //=======================================================================
182 Standard_Boolean GEOMUtils::TrsfCurve2d::IsPeriodic() const
184 return myCurve.IsPeriodic();
187 //=======================================================================
190 //=======================================================================
191 Standard_Real GEOMUtils::TrsfCurve2d::Period() const
193 return myCurve.Period();
196 //=======================================================================
199 //=======================================================================
200 gp_Pnt2d GEOMUtils::TrsfCurve2d::Value(const Standard_Real U) const
202 gp_Pnt2d aPnt = myCurve.Value(U);
204 myTrsf.TransformD0(aPnt);
209 //=======================================================================
212 //=======================================================================
213 void GEOMUtils::TrsfCurve2d::D0(const Standard_Real U, gp_Pnt2d &P) const
216 myTrsf.TransformD0(P);
219 //=======================================================================
222 //=======================================================================
223 void GEOMUtils::TrsfCurve2d::D1(const Standard_Real U,
224 gp_Pnt2d &P, gp_Vec2d &V) const
227 myTrsf.TransformD1(P, V);
230 //=======================================================================
233 //=======================================================================
234 void GEOMUtils::TrsfCurve2d::D2(const Standard_Real U, gp_Pnt2d &P,
235 gp_Vec2d &V1, gp_Vec2d &V2) const
237 myCurve.D2(U, P, V1, V2);
238 myTrsf.TransformD2(P, V1, V2);
241 //=======================================================================
244 //=======================================================================
245 void GEOMUtils::TrsfCurve2d::D3(const Standard_Real U, gp_Pnt2d &P,
246 gp_Vec2d &V1, gp_Vec2d &V2, gp_Vec2d &V3) const
248 myCurve.D3(U, P, V1, V2, V3);
249 myTrsf.TransformD3(P, V1, V2, V3);
252 //=======================================================================
255 //=======================================================================
256 gp_Vec2d GEOMUtils::TrsfCurve2d::DN(const Standard_Real U,
257 const Standard_Integer N) const
259 gp_Pnt2d aPnt = myCurve.Value(U);
260 gp_Vec2d aVec = myCurve.DN(U, N);
262 myTrsf.TransformD1(aPnt, aVec);
266 //=======================================================================
267 //function : Resolution
269 //=======================================================================
270 Standard_Real GEOMUtils::TrsfCurve2d::Resolution(const Standard_Real Ruv) const
272 return Precision::Parametric(Ruv);
275 //=======================================================================
278 //=======================================================================
279 gp_Lin2d GEOMUtils::TrsfCurve2d::Line() const
281 Standard_NoSuchObject::Raise();
286 //=======================================================================
289 //=======================================================================
290 gp_Circ2d GEOMUtils::TrsfCurve2d::Circle() const
292 Standard_NoSuchObject::Raise();
297 //=======================================================================
300 //=======================================================================
301 gp_Elips2d GEOMUtils::TrsfCurve2d::Ellipse() const
303 Standard_NoSuchObject::Raise();
308 //=======================================================================
309 //function : Hyperbola
311 //=======================================================================
312 gp_Hypr2d GEOMUtils::TrsfCurve2d::Hyperbola() const
314 Standard_NoSuchObject::Raise();
319 //=======================================================================
320 //function : Parabola
322 //=======================================================================
323 gp_Parab2d GEOMUtils::TrsfCurve2d::Parabola() const
325 Standard_NoSuchObject::Raise();
330 //=======================================================================
333 //=======================================================================
334 Standard_Integer GEOMUtils::TrsfCurve2d::Degree() const
336 Standard_NoSuchObject::Raise();
341 //=======================================================================
342 //function : IsRational
344 //=======================================================================
345 Standard_Boolean GEOMUtils::TrsfCurve2d::IsRational() const
347 return Standard_False;
350 //=======================================================================
353 //=======================================================================
354 Standard_Integer GEOMUtils::TrsfCurve2d::NbPoles() const
356 Standard_NoSuchObject::Raise();
361 //=======================================================================
364 //=======================================================================
365 Standard_Integer GEOMUtils::TrsfCurve2d::NbKnots() const
367 Standard_NoSuchObject::Raise();
372 //=======================================================================
375 //=======================================================================
376 Handle(Geom2d_BezierCurve) GEOMUtils::TrsfCurve2d::Bezier() const
378 Standard_NoSuchObject::Raise();
383 //=======================================================================
386 //=======================================================================
387 Handle(Geom2d_BSplineCurve) GEOMUtils::TrsfCurve2d::BSpline() const
389 Standard_NoSuchObject::Raise();
394 //=======================================================================
395 //function : NbSamples
397 //=======================================================================
398 Standard_Integer GEOMUtils::TrsfCurve2d::NbSamples() const
400 return myCurve.NbSamples();