1 // Created on: 1993-02-19
2 // Created by: Remi LEQUETTE
3 // Copyright (c) 1993-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.
17 #ifndef _BRepAdaptor_Curve_HeaderFile
18 #define _BRepAdaptor_Curve_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
24 #include <gp_Trsf.hxx>
25 #include <GeomAdaptor_Curve.hxx>
26 #include <TopoDS_Edge.hxx>
27 #include <Adaptor3d_Curve.hxx>
28 #include <Standard_Boolean.hxx>
29 #include <Standard_Real.hxx>
30 #include <GeomAbs_Shape.hxx>
31 #include <Standard_Integer.hxx>
32 #include <TColStd_Array1OfReal.hxx>
33 #include <GeomAbs_CurveType.hxx>
34 class Adaptor3d_HCurveOnSurface;
35 class Standard_NullObject;
36 class Standard_DomainError;
37 class Standard_OutOfRange;
38 class Standard_NoSuchObject;
42 class GeomAdaptor_Curve;
43 class Adaptor3d_CurveOnSurface;
44 class Adaptor3d_HCurve;
52 class Geom_BezierCurve;
53 class Geom_BSplineCurve;
56 //! The Curve from BRepAdaptor allows to use an Edge
57 //! of the BRep topology like a 3D curve.
59 //! It has the methods the class Curve from Adaptor3d.
61 //! It is created or Initialized with an Edge. It
62 //! takes into account local coordinate systems. If
63 //! the Edge has a 3D curve it is use with priority.
64 //! If the edge has no 3D curve one of the curves on
65 //! surface is used. It is possible to enforce using a
66 //! curve on surface by creating or initialising with
67 //! an Edge and a Face.
68 class BRepAdaptor_Curve : public Adaptor3d_Curve
75 //! Creates an undefined Curve with no Edge loaded.
76 Standard_EXPORT BRepAdaptor_Curve();
78 //! Creates a Curve to acces to the geometry of edge
80 Standard_EXPORT BRepAdaptor_Curve(const TopoDS_Edge& E);
82 //! Creates a Curve to acces to the geometry of edge
83 //! <E>. The geometry will be computed using the
84 //! parametric curve of <E> on the face <F>. An Error
85 //! is raised if the edge does not have a pcurve on
87 Standard_EXPORT BRepAdaptor_Curve(const TopoDS_Edge& E, const TopoDS_Face& F);
89 //! Sets the Curve <me> to acces to the geometry of
91 Standard_EXPORT void Initialize (const TopoDS_Edge& E);
93 //! Sets the Curve <me> to acces to the geometry of
94 //! edge <E>. The geometry will be computed using the
95 //! parametric curve of <E> on the face <F>. An Error
96 //! is raised if the edge does not have a pcurve on
98 Standard_EXPORT void Initialize (const TopoDS_Edge& E, const TopoDS_Face& F);
100 //! Returns the coordinate system of the curve.
101 Standard_EXPORT const gp_Trsf& Trsf() const;
103 //! Returns True if the edge geometry is computed from
105 Standard_EXPORT Standard_Boolean Is3DCurve() const;
107 //! Returns True if the edge geometry is computed from
108 //! a pcurve on a surface.
109 Standard_EXPORT Standard_Boolean IsCurveOnSurface() const;
111 //! Returns the Curve of the edge.
112 Standard_EXPORT const GeomAdaptor_Curve& Curve() const;
114 //! Returns the CurveOnSurface of the edge.
115 Standard_EXPORT const Adaptor3d_CurveOnSurface& CurveOnSurface() const;
117 //! Returns the edge.
118 Standard_EXPORT const TopoDS_Edge& Edge() const;
120 //! Returns the edge tolerance.
121 Standard_EXPORT Standard_Real Tolerance() const;
123 Standard_EXPORT Standard_Real FirstParameter() const Standard_OVERRIDE;
125 Standard_EXPORT Standard_Real LastParameter() const Standard_OVERRIDE;
127 Standard_EXPORT GeomAbs_Shape Continuity() const Standard_OVERRIDE;
129 //! Returns the number of intervals for continuity
130 //! <S>. May be one if Continuity(me) >= <S>
131 Standard_EXPORT Standard_Integer NbIntervals (const GeomAbs_Shape S) const Standard_OVERRIDE;
133 //! Stores in <T> the parameters bounding the intervals
134 //! of continuity <S>.
136 //! The array must provide enough room to accomodate
137 //! for the parameters. i.e. T.Length() > NbIntervals()
138 Standard_EXPORT void Intervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const Standard_OVERRIDE;
140 //! Returns a curve equivalent of <me> between
141 //! parameters <First> and <Last>. <Tol> is used to
142 //! test for 3d points confusion.
143 //! If <First> >= <Last>
144 Standard_EXPORT Handle(Adaptor3d_HCurve) Trim (const Standard_Real First, const Standard_Real Last, const Standard_Real Tol) const Standard_OVERRIDE;
146 Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE;
148 Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE;
150 Standard_EXPORT Standard_Real Period() const Standard_OVERRIDE;
152 //! Computes the point of parameter U on the curve
153 Standard_EXPORT gp_Pnt Value (const Standard_Real U) const Standard_OVERRIDE;
155 //! Computes the point of parameter U.
156 Standard_EXPORT void D0 (const Standard_Real U, gp_Pnt& P) const Standard_OVERRIDE;
158 //! Computes the point of parameter U on the curve
159 //! with its first derivative.
160 //! Raised if the continuity of the current interval
162 Standard_EXPORT void D1 (const Standard_Real U, gp_Pnt& P, gp_Vec& V) const Standard_OVERRIDE;
165 //! Returns the point P of parameter U, the first and second
166 //! derivatives V1 and V2.
167 //! Raised if the continuity of the current interval
169 Standard_EXPORT void D2 (const Standard_Real U, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2) const Standard_OVERRIDE;
172 //! Returns the point P of parameter U, the first, the second
173 //! and the third derivative.
174 //! Raised if the continuity of the current interval
176 Standard_EXPORT void D3 (const Standard_Real U, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2, gp_Vec& V3) const Standard_OVERRIDE;
179 //! The returned vector gives the value of the derivative for the
180 //! order of derivation N.
181 //! Raised if the continuity of the current interval
184 Standard_EXPORT gp_Vec DN (const Standard_Real U, const Standard_Integer N) const Standard_OVERRIDE;
186 //! returns the parametric resolution
187 Standard_EXPORT Standard_Real Resolution (const Standard_Real R3d) const Standard_OVERRIDE;
189 Standard_EXPORT GeomAbs_CurveType GetType() const Standard_OVERRIDE;
191 Standard_EXPORT gp_Lin Line() const Standard_OVERRIDE;
193 Standard_EXPORT gp_Circ Circle() const Standard_OVERRIDE;
195 Standard_EXPORT gp_Elips Ellipse() const Standard_OVERRIDE;
197 Standard_EXPORT gp_Hypr Hyperbola() const Standard_OVERRIDE;
199 Standard_EXPORT gp_Parab Parabola() const Standard_OVERRIDE;
201 Standard_EXPORT Standard_Integer Degree() const Standard_OVERRIDE;
203 Standard_EXPORT Standard_Boolean IsRational() const Standard_OVERRIDE;
205 Standard_EXPORT Standard_Integer NbPoles() const Standard_OVERRIDE;
207 Standard_EXPORT Standard_Integer NbKnots() const Standard_OVERRIDE;
211 //! This will make a copy of the Bezier Curve
212 //! since it applies to it myTsrf . Be carefull when
213 //! using this method
214 Standard_EXPORT Handle(Geom_BezierCurve) Bezier() const Standard_OVERRIDE;
218 //! This will make a copy of the BSpline Curve
219 //! since it applies to it myTsrf . Be carefull when
220 //! using this method
221 Standard_EXPORT Handle(Geom_BSplineCurve) BSpline() const Standard_OVERRIDE;
237 GeomAdaptor_Curve myCurve;
238 Handle(Adaptor3d_HCurveOnSurface) myConSurf;
250 #endif // _BRepAdaptor_Curve_HeaderFile