1 // Created on: 1993-04-01
2 // Created by: Modelistation
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 _HLRBRep_Curve_HeaderFile
18 #define _HLRBRep_Curve_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
24 #include <BRepAdaptor_Curve.hxx>
25 #include <GeomAbs_CurveType.hxx>
26 #include <Standard_Real.hxx>
28 #include <Standard_Boolean.hxx>
29 #include <GeomAbs_Shape.hxx>
30 #include <Standard_Integer.hxx>
31 #include <TColStd_Array1OfReal.hxx>
32 #include <gp_Pnt2d.hxx>
33 #include <TColgp_Array1OfPnt2d.hxx>
34 #include <TColStd_Array1OfInteger.hxx>
35 class Standard_NoSuchObject;
36 class Standard_DomainError;
37 class Standard_OutOfRange;
38 class StdFail_UndefinedDerivative;
39 class BRepAdaptor_Curve;
51 class Geom_BSplineCurve;
52 class HLRAlgo_Projector;
55 //! Defines a 2d curve by projection of a 3D curve on
56 //! a plane with an optional perspective
65 //! Creates an undefined Curve.
66 Standard_EXPORT HLRBRep_Curve();
68 void Projector (const HLRAlgo_Projector* Proj)
71 //! Returns the 3D curve.
72 BRepAdaptor_Curve& Curve();
74 //! Sets the 3D curve to be projected.
75 Standard_EXPORT void Curve (const TopoDS_Edge& E);
77 //! Returns the 3D curve.
78 const BRepAdaptor_Curve& GetCurve() const;
80 //! Returns the parameter on the 2d curve from the
81 //! parameter on the 3d curve.
82 Standard_EXPORT Standard_Real Parameter2d (const Standard_Real P3d) const;
84 //! Returns the parameter on the 3d curve from the
85 //! parameter on the 2d curve.
86 Standard_EXPORT Standard_Real Parameter3d (const Standard_Real P2d) const;
88 //! Update the minmax and the internal data
89 Standard_EXPORT Standard_Real Update (Standard_Real TotMin[16], Standard_Real TotMax[16]);
91 //! Update the minmax returns tol for enlarge;
92 Standard_EXPORT Standard_Real UpdateMinMax (Standard_Real TotMin[16], Standard_Real TotMax[16]);
94 //! Computes the Z coordinate of the point of
95 //! parameter U on the curve in the viewing coordinate system
96 Standard_EXPORT Standard_Real Z (const Standard_Real U) const;
98 //! Computes the 3D point of parameter U on the
100 gp_Pnt Value3D (const Standard_Real U) const;
102 //! Computes the 3D point of parameter U on the
104 void D0 (const Standard_Real U, gp_Pnt& P) const;
106 //! Computes the point of parameter U on the curve
107 //! with its first derivative.
108 void D1 (const Standard_Real U, gp_Pnt& P, gp_Vec& V) const;
110 //! Depending on <AtStart> computes the 2D point and
111 //! tangent on the curve at sart (or at end). If the first
112 //! derivative is null look after at start (or before at end)
113 //! with the second derivative.
114 Standard_EXPORT void Tangent (const Standard_Boolean AtStart, gp_Pnt2d& P, gp_Dir2d& D) const;
116 Standard_Real FirstParameter() const;
118 Standard_Real LastParameter() const;
120 GeomAbs_Shape Continuity() const;
122 //! If necessary, breaks the curve in intervals of
123 //! continuity <S>. And returns the number of
125 Standard_Integer NbIntervals (const GeomAbs_Shape S) const;
127 //! Stores in <T> the parameters bounding the intervals
128 //! of continuity <S>.
130 //! The array must provide enough room to accomodate
131 //! for the parameters. i.e. T.Length() > NbIntervals()
132 void Intervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const;
134 Standard_Boolean IsClosed() const;
136 Standard_Boolean IsPeriodic() const;
138 Standard_Real Period() const;
140 //! Computes the point of parameter U on the curve.
141 gp_Pnt2d Value (const Standard_Real U) const;
143 //! Computes the point of parameter U on the curve.
144 Standard_EXPORT void D0 (const Standard_Real U, gp_Pnt2d& P) const;
146 //! Computes the point of parameter U on the curve
147 //! with its first derivative.
148 //! Raised if the continuity of the current interval
150 Standard_EXPORT void D1 (const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V) const;
152 //! Raised if the continuity of the current interval
154 Standard_EXPORT void D2 (const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2) const;
157 //! Returns the point P of parameter U, the first, the second
158 //! and the third derivative.
159 //! Raised if the continuity of the current interval
161 Standard_EXPORT void D3 (const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2, gp_Vec2d& V3) const;
164 //! The returned vector gives the value of the derivative for the
165 //! order of derivation N.
166 //! Raised if the continuity of the current interval
169 Standard_EXPORT gp_Vec2d DN (const Standard_Real U, const Standard_Integer N) const;
171 //! Returns the parametric resolution corresponding
172 //! to the real space resolution <R3d>.
173 Standard_Real Resolution (const Standard_Real R3d) const;
175 //! Returns the type of the curve in the current
176 //! interval : Line, Circle, Ellipse, Hyperbola,
177 //! Parabola, BezierCurve, BSplineCurve, OtherCurve.
178 GeomAbs_CurveType GetType() const;
180 Standard_EXPORT gp_Lin2d Line() const;
182 Standard_EXPORT gp_Circ2d Circle() const;
184 Standard_EXPORT gp_Elips2d Ellipse() const;
186 Standard_EXPORT gp_Hypr2d Hyperbola() const;
188 Standard_EXPORT gp_Parab2d Parabola() const;
190 Standard_Boolean IsRational() const;
192 Standard_Integer Degree() const;
194 Standard_Integer NbPoles() const;
196 Standard_EXPORT void Poles (TColgp_Array1OfPnt2d& TP) const;
198 Standard_EXPORT void Poles (const Handle(Geom_BSplineCurve)& aCurve, TColgp_Array1OfPnt2d& TP) const;
200 Standard_EXPORT void PolesAndWeights (TColgp_Array1OfPnt2d& TP, TColStd_Array1OfReal& TW) const;
202 Standard_EXPORT void PolesAndWeights (const Handle(Geom_BSplineCurve)& aCurve, TColgp_Array1OfPnt2d& TP, TColStd_Array1OfReal& TW) const;
204 Standard_Integer NbKnots() const;
206 Standard_EXPORT void Knots (TColStd_Array1OfReal& kn) const;
208 Standard_EXPORT void Multiplicities (TColStd_Array1OfInteger& mu) const;
223 BRepAdaptor_Curve myCurve;
224 GeomAbs_CurveType myType;
225 const HLRAlgo_Projector* myProj;
236 #include <HLRBRep_Curve.lxx>
242 #endif // _HLRBRep_Curve_HeaderFile