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;
54 class Geom_OffsetCurve;
57 //! The Curve from BRepAdaptor allows to use an Edge
58 //! of the BRep topology like a 3D curve.
60 //! It has the methods the class Curve from Adaptor3d.
62 //! It is created or Initialized with an Edge. It
63 //! takes into account local coordinate systems. If
64 //! the Edge has a 3D curve it is use with priority.
65 //! If the edge has no 3D curve one of the curves on
66 //! surface is used. It is possible to enforce using a
67 //! curve on surface by creating or initialising with
68 //! an Edge and a Face.
69 class BRepAdaptor_Curve : public Adaptor3d_Curve
76 //! Creates an undefined Curve with no Edge loaded.
77 Standard_EXPORT BRepAdaptor_Curve();
79 //! Creates a Curve to acces to the geometry of edge
81 Standard_EXPORT BRepAdaptor_Curve(const TopoDS_Edge& E);
83 //! Creates a Curve to acces to the geometry of edge
84 //! <E>. The geometry will be computed using the
85 //! parametric curve of <E> on the face <F>. An Error
86 //! is raised if the edge does not have a pcurve on
88 Standard_EXPORT BRepAdaptor_Curve(const TopoDS_Edge& E, const TopoDS_Face& F);
90 //! Reset currently loaded curve (undone Load()).
91 Standard_EXPORT void Reset();
93 //! Sets the Curve <me> to acces to the geometry of
95 Standard_EXPORT void Initialize (const TopoDS_Edge& E);
97 //! Sets the Curve <me> to acces to the geometry of
98 //! edge <E>. The geometry will be computed using the
99 //! parametric curve of <E> on the face <F>. An Error
100 //! is raised if the edge does not have a pcurve on
102 Standard_EXPORT void Initialize (const TopoDS_Edge& E, const TopoDS_Face& F);
104 //! Returns the coordinate system of the curve.
105 Standard_EXPORT const gp_Trsf& Trsf() const;
107 //! Returns True if the edge geometry is computed from
109 Standard_EXPORT Standard_Boolean Is3DCurve() const;
111 //! Returns True if the edge geometry is computed from
112 //! a pcurve on a surface.
113 Standard_EXPORT Standard_Boolean IsCurveOnSurface() const;
115 //! Returns the Curve of the edge.
116 Standard_EXPORT const GeomAdaptor_Curve& Curve() const;
118 //! Returns the CurveOnSurface of the edge.
119 Standard_EXPORT const Adaptor3d_CurveOnSurface& CurveOnSurface() const;
121 //! Returns the edge.
122 Standard_EXPORT const TopoDS_Edge& Edge() const;
124 //! Returns the edge tolerance.
125 Standard_EXPORT Standard_Real Tolerance() const;
127 Standard_EXPORT Standard_Real FirstParameter() const Standard_OVERRIDE;
129 Standard_EXPORT Standard_Real LastParameter() const Standard_OVERRIDE;
131 Standard_EXPORT GeomAbs_Shape Continuity() const Standard_OVERRIDE;
133 //! Returns the number of intervals for continuity
134 //! <S>. May be one if Continuity(me) >= <S>
135 Standard_EXPORT Standard_Integer NbIntervals (const GeomAbs_Shape S) const Standard_OVERRIDE;
137 //! Stores in <T> the parameters bounding the intervals
138 //! of continuity <S>.
140 //! The array must provide enough room to accomodate
141 //! for the parameters. i.e. T.Length() > NbIntervals()
142 Standard_EXPORT void Intervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const Standard_OVERRIDE;
144 //! Returns a curve equivalent of <me> between
145 //! parameters <First> and <Last>. <Tol> is used to
146 //! test for 3d points confusion.
147 //! If <First> >= <Last>
148 Standard_EXPORT Handle(Adaptor3d_HCurve) Trim (const Standard_Real First, const Standard_Real Last, const Standard_Real Tol) const Standard_OVERRIDE;
150 Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE;
152 Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE;
154 Standard_EXPORT Standard_Real Period() const Standard_OVERRIDE;
156 //! Computes the point of parameter U on the curve
157 Standard_EXPORT gp_Pnt Value (const Standard_Real U) const Standard_OVERRIDE;
159 //! Computes the point of parameter U.
160 Standard_EXPORT void D0 (const Standard_Real U, gp_Pnt& P) const Standard_OVERRIDE;
162 //! Computes the point of parameter U on the curve
163 //! with its first derivative.
164 //! Raised if the continuity of the current interval
166 Standard_EXPORT void D1 (const Standard_Real U, gp_Pnt& P, gp_Vec& V) const Standard_OVERRIDE;
169 //! Returns the point P of parameter U, the first and second
170 //! derivatives V1 and V2.
171 //! Raised if the continuity of the current interval
173 Standard_EXPORT void D2 (const Standard_Real U, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2) const Standard_OVERRIDE;
176 //! Returns the point P of parameter U, the first, the second
177 //! and the third derivative.
178 //! Raised if the continuity of the current interval
180 Standard_EXPORT void D3 (const Standard_Real U, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2, gp_Vec& V3) const Standard_OVERRIDE;
183 //! The returned vector gives the value of the derivative for the
184 //! order of derivation N.
185 //! Raised if the continuity of the current interval
188 Standard_EXPORT gp_Vec DN (const Standard_Real U, const Standard_Integer N) const Standard_OVERRIDE;
190 //! returns the parametric resolution
191 Standard_EXPORT Standard_Real Resolution (const Standard_Real R3d) const Standard_OVERRIDE;
193 Standard_EXPORT GeomAbs_CurveType GetType() const Standard_OVERRIDE;
195 Standard_EXPORT gp_Lin Line() const Standard_OVERRIDE;
197 Standard_EXPORT gp_Circ Circle() const Standard_OVERRIDE;
199 Standard_EXPORT gp_Elips Ellipse() const Standard_OVERRIDE;
201 Standard_EXPORT gp_Hypr Hyperbola() const Standard_OVERRIDE;
203 Standard_EXPORT gp_Parab Parabola() const Standard_OVERRIDE;
205 Standard_EXPORT Standard_Integer Degree() const Standard_OVERRIDE;
207 Standard_EXPORT Standard_Boolean IsRational() const Standard_OVERRIDE;
209 Standard_EXPORT Standard_Integer NbPoles() const Standard_OVERRIDE;
211 Standard_EXPORT Standard_Integer NbKnots() const Standard_OVERRIDE;
215 //! This will make a copy of the Bezier Curve
216 //! since it applies to it myTsrf . Be carefull when
217 //! using this method
218 Standard_EXPORT Handle(Geom_BezierCurve) Bezier() const Standard_OVERRIDE;
222 //! This will make a copy of the BSpline Curve
223 //! since it applies to it myTsrf . Be carefull when
224 //! using this method
225 Standard_EXPORT Handle(Geom_BSplineCurve) BSpline() const Standard_OVERRIDE;
227 Standard_EXPORT Handle(Geom_OffsetCurve) OffsetCurve() const Standard_OVERRIDE;
242 GeomAdaptor_Curve myCurve;
243 Handle(Adaptor3d_HCurveOnSurface) myConSurf;
255 #endif // _BRepAdaptor_Curve_HeaderFile