1 // Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
24 #include <GEOMUtils_TrsfCurve2d.hxx>
25 #include <GEOMUtils_HTrsfCurve2d.hxx>
27 //=======================================================================
28 //function : TrsfCurve2d
30 //=======================================================================
31 GEOMUtils::TrsfCurve2d::TrsfCurve2d(const Handle(Geom2d_Curve) &theCurve,
32 const Trsf2d &theTrsf)
38 //=======================================================================
39 //function : TrsfCurve2d
41 //=======================================================================
42 GEOMUtils::TrsfCurve2d::TrsfCurve2d(const Handle(Geom2d_Curve) &theCurve,
43 const Standard_Real theUFirst,
44 const Standard_Real theULast,
45 const Trsf2d &theTrsf)
46 : myCurve (theCurve, theUFirst, theULast),
51 //=======================================================================
52 //function : FirstParameter
54 //=======================================================================
55 Standard_Real GEOMUtils::TrsfCurve2d::FirstParameter() const
57 return myCurve.FirstParameter();
60 //=======================================================================
61 //function : LastParameter
63 //=======================================================================
64 Standard_Real GEOMUtils::TrsfCurve2d::LastParameter() const
66 return myCurve.LastParameter();
69 //=======================================================================
72 //=======================================================================
73 const Handle(Geom2d_Curve) &GEOMUtils::TrsfCurve2d::Curve() const
75 return myCurve.Curve();
78 //=======================================================================
81 //=======================================================================
82 GeomAbs_CurveType GEOMUtils::TrsfCurve2d::GetType() const
84 return GeomAbs_OtherCurve;
87 //=======================================================================
90 //=======================================================================
91 void GEOMUtils::TrsfCurve2d::Load(const Handle(Geom2d_Curve) &C)
96 //=======================================================================
99 //=======================================================================
100 void GEOMUtils::TrsfCurve2d::Load(const Handle(Geom2d_Curve) &C,
101 const Standard_Real UFirst,
102 const Standard_Real ULast)
104 myCurve.Load(C, UFirst, ULast);
107 //=======================================================================
108 //function : Continuity
110 //=======================================================================
111 GeomAbs_Shape GEOMUtils::TrsfCurve2d::Continuity() const
113 return myCurve.Continuity();
116 //=======================================================================
117 //function : NbIntervals
119 //=======================================================================
120 Standard_Integer GEOMUtils::TrsfCurve2d::NbIntervals
121 (const GeomAbs_Shape S) const
123 return myCurve.NbIntervals(S);
126 //=======================================================================
127 //function : Intervals
129 //=======================================================================
130 void GEOMUtils::TrsfCurve2d::Intervals(TColStd_Array1OfReal &T,
131 const GeomAbs_Shape S) const
133 myCurve.Intervals(T, S);
136 //=======================================================================
139 //=======================================================================
140 Handle(Adaptor2d_HCurve2d) GEOMUtils::TrsfCurve2d::Trim
141 (const Standard_Real First, const Standard_Real Last,
142 const Standard_Real /*Tol*/) const
144 Handle(Geom2d_Curve) aCurve = myCurve.Curve();
145 GEOMUtils::Handle(HTrsfCurve2d) aAHCurve =
146 new GEOMUtils::HTrsfCurve2d(aCurve, First, Last, myTrsf);
151 //=======================================================================
152 //function : IsClosed
154 //=======================================================================
155 Standard_Boolean GEOMUtils::TrsfCurve2d::IsClosed() const
157 return myCurve.IsClosed();
160 //=======================================================================
161 //function : IsPeriodic
163 //=======================================================================
164 Standard_Boolean GEOMUtils::TrsfCurve2d::IsPeriodic() const
166 return myCurve.IsPeriodic();
169 //=======================================================================
172 //=======================================================================
173 Standard_Real GEOMUtils::TrsfCurve2d::Period() const
175 return myCurve.Period();
178 //=======================================================================
181 //=======================================================================
182 gp_Pnt2d GEOMUtils::TrsfCurve2d::Value(const Standard_Real U) const
184 gp_Pnt2d aPnt = myCurve.Value(U);
186 myTrsf.TransformD0(aPnt);
191 //=======================================================================
194 //=======================================================================
195 void GEOMUtils::TrsfCurve2d::D0(const Standard_Real U, gp_Pnt2d &P) const
198 myTrsf.TransformD0(P);
201 //=======================================================================
204 //=======================================================================
205 void GEOMUtils::TrsfCurve2d::D1(const Standard_Real U,
206 gp_Pnt2d &P, gp_Vec2d &V) const
209 myTrsf.TransformD1(P, V);
212 //=======================================================================
215 //=======================================================================
216 void GEOMUtils::TrsfCurve2d::D2(const Standard_Real U, gp_Pnt2d &P,
217 gp_Vec2d &V1, gp_Vec2d &V2) const
219 myCurve.D2(U, P, V1, V2);
220 myTrsf.TransformD2(P, V1, V2);
223 //=======================================================================
226 //=======================================================================
227 void GEOMUtils::TrsfCurve2d::D3(const Standard_Real U, gp_Pnt2d &P,
228 gp_Vec2d &V1, gp_Vec2d &V2, gp_Vec2d &V3) const
230 myCurve.D3(U, P, V1, V2, V3);
231 myTrsf.TransformD3(P, V1, V2, V3);
234 //=======================================================================
237 //=======================================================================
238 gp_Vec2d GEOMUtils::TrsfCurve2d::DN(const Standard_Real U,
239 const Standard_Integer N) const
241 gp_Pnt2d aPnt = myCurve.Value(U);
242 gp_Vec2d aVec = myCurve.DN(U, N);
244 myTrsf.TransformD1(aPnt, aVec);
247 //=======================================================================
248 //function : Resolution
250 //=======================================================================
251 Standard_Real GEOMUtils::TrsfCurve2d::Resolution(const Standard_Real Ruv) const
253 return Precision::Parametric(Ruv);
256 //=======================================================================
259 //=======================================================================
260 gp_Lin2d GEOMUtils::TrsfCurve2d::Line() const
262 Standard_NoSuchObject::Raise();
267 //=======================================================================
270 //=======================================================================
271 gp_Circ2d GEOMUtils::TrsfCurve2d::Circle() const
273 Standard_NoSuchObject::Raise();
278 //=======================================================================
281 //=======================================================================
282 gp_Elips2d GEOMUtils::TrsfCurve2d::Ellipse() const
284 Standard_NoSuchObject::Raise();
289 //=======================================================================
290 //function : Hyperbola
292 //=======================================================================
293 gp_Hypr2d GEOMUtils::TrsfCurve2d::Hyperbola() const
295 Standard_NoSuchObject::Raise();
300 //=======================================================================
301 //function : Parabola
303 //=======================================================================
304 gp_Parab2d GEOMUtils::TrsfCurve2d::Parabola() const
306 Standard_NoSuchObject::Raise();
311 //=======================================================================
314 //=======================================================================
315 Standard_Integer GEOMUtils::TrsfCurve2d::Degree() const
317 Standard_NoSuchObject::Raise();
322 //=======================================================================
323 //function : IsRational
325 //=======================================================================
326 Standard_Boolean GEOMUtils::TrsfCurve2d::IsRational() const
328 return Standard_False;
331 //=======================================================================
334 //=======================================================================
335 Standard_Integer GEOMUtils::TrsfCurve2d::NbPoles() const
337 Standard_NoSuchObject::Raise();
342 //=======================================================================
345 //=======================================================================
346 Standard_Integer GEOMUtils::TrsfCurve2d::NbKnots() const
348 Standard_NoSuchObject::Raise();
353 //=======================================================================
356 //=======================================================================
357 Handle(Geom2d_BezierCurve) GEOMUtils::TrsfCurve2d::Bezier() const
359 Standard_NoSuchObject::Raise();
364 //=======================================================================
367 //=======================================================================
368 Handle(Geom2d_BSplineCurve) GEOMUtils::TrsfCurve2d::BSpline() const
370 Standard_NoSuchObject::Raise();
375 //=======================================================================
376 //function : NbSamples
378 //=======================================================================
379 Standard_Integer GEOMUtils::TrsfCurve2d::NbSamples() const
381 return myCurve.NbSamples();