5d3a3e3ca802563595c04391e85b08ce6b8e15f2
[occt.git] / src / HLRBRep / HLRBRep_BCurveTool.hxx
1 // Created on: 1995-07-17
2 // Created by: Modelistation
3 // Copyright (c) 1995-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
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.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17 #ifndef _HLRBRep_BCurveTool_HeaderFile
18 #define _HLRBRep_BCurveTool_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
23
24 #include <Standard_Real.hxx>
25 #include <GeomAbs_Shape.hxx>
26 #include <Standard_Integer.hxx>
27 #include <TColStd_Array1OfReal.hxx>
28 #include <Standard_Boolean.hxx>
29 #include <gp_Pnt.hxx>
30 #include <gp_Vec.hxx>
31 #include <GeomAbs_CurveType.hxx>
32 #include <gp_Lin.hxx>
33 #include <gp_Circ.hxx>
34 #include <gp_Elips.hxx>
35 #include <gp_Hypr.hxx>
36 #include <gp_Parab.hxx>
37 #include <TColgp_Array1OfPnt.hxx>
38 class Standard_OutOfRange;
39 class Standard_NoSuchObject;
40 class Standard_DomainError;
41 class BRepAdaptor_Curve;
42 class gp_Pnt;
43 class gp_Vec;
44 class Geom_BezierCurve;
45 class Geom_BSplineCurve;
46
47
48
49 class HLRBRep_BCurveTool 
50 {
51 public:
52
53   DEFINE_STANDARD_ALLOC
54
55   
56     static Standard_Real FirstParameter (const BRepAdaptor_Curve& C);
57   
58     static Standard_Real LastParameter (const BRepAdaptor_Curve& C);
59   
60     static GeomAbs_Shape Continuity (const BRepAdaptor_Curve& C);
61   
62   //! Returns  the number  of  intervals for  continuity
63   //! <S>. May be one if Continuity(myclass) >= <S>
64     static Standard_Integer NbIntervals (const BRepAdaptor_Curve& C, const GeomAbs_Shape S);
65   
66   //! Stores in <T> the  parameters bounding the intervals
67   //! of continuity <S>.
68   //!
69   //! The array must provide  enough room to  accomodate
70   //! for the parameters. i.e. T.Length() > NbIntervals()
71     static void Intervals (const BRepAdaptor_Curve& C, TColStd_Array1OfReal& T, const GeomAbs_Shape S);
72   
73     static Standard_Boolean IsClosed (const BRepAdaptor_Curve& C);
74   
75     static Standard_Boolean IsPeriodic (const BRepAdaptor_Curve& C);
76   
77     static Standard_Real Period (const BRepAdaptor_Curve& C);
78   
79   //! Computes the point of parameter U on the curve.
80     static gp_Pnt Value (const BRepAdaptor_Curve& C, const Standard_Real U);
81   
82   //! Computes the point of parameter U on the curve.
83     static void D0 (const BRepAdaptor_Curve& C, const Standard_Real U, gp_Pnt& P);
84   
85   //! Computes the point of parameter U on the curve with its
86   //! first derivative.
87   //! Raised if the continuity of the current interval
88   //! is not C1.
89     static void D1 (const BRepAdaptor_Curve& C, const Standard_Real U, gp_Pnt& P, gp_Vec& V);
90   
91
92   //! Returns the point P of parameter U, the first and second
93   //! derivatives V1 and V2.
94   //! Raised if the continuity of the current interval
95   //! is not C2.
96     static void D2 (const BRepAdaptor_Curve& C, const Standard_Real U, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2);
97   
98
99   //! Returns the point P of parameter U, the first, the second
100   //! and the third derivative.
101   //! Raised if the continuity of the current interval
102   //! is not C3.
103     static void D3 (const BRepAdaptor_Curve& C, const Standard_Real U, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2, gp_Vec& V3);
104   
105
106   //! The returned vector gives the value of the derivative for the
107   //! order of derivation N.
108   //! Raised if the continuity of the current interval
109   //! is not CN.
110   //! Raised if N < 1.
111     static gp_Vec DN (const BRepAdaptor_Curve& C, const Standard_Real U, const Standard_Integer N);
112   
113   //! Returns the parametric  resolution corresponding
114   //! to the real space resolution <R3d>.
115     static Standard_Real Resolution (const BRepAdaptor_Curve& C, const Standard_Real R3d);
116   
117   //! Returns  the  type of the   curve  in the  current
118   //! interval :   Line,   Circle,   Ellipse, Hyperbola,
119   //! Parabola, BezierCurve, BSplineCurve, OtherCurve.
120     static GeomAbs_CurveType GetType (const BRepAdaptor_Curve& C);
121   
122     static gp_Lin Line (const BRepAdaptor_Curve& C);
123   
124     static gp_Circ Circle (const BRepAdaptor_Curve& C);
125   
126     static gp_Elips Ellipse (const BRepAdaptor_Curve& C);
127   
128     static gp_Hypr Hyperbola (const BRepAdaptor_Curve& C);
129   
130     static gp_Parab Parabola (const BRepAdaptor_Curve& C);
131   
132   Standard_EXPORT static Handle(Geom_BezierCurve) Bezier (const BRepAdaptor_Curve& C);
133   
134   Standard_EXPORT static Handle(Geom_BSplineCurve) BSpline (const BRepAdaptor_Curve& C);
135   
136     static Standard_Integer Degree (const BRepAdaptor_Curve& C);
137   
138     static Standard_Boolean IsRational (const BRepAdaptor_Curve& C);
139   
140     static Standard_Integer NbPoles (const BRepAdaptor_Curve& C);
141   
142     static Standard_Integer NbKnots (const BRepAdaptor_Curve& C);
143   
144   Standard_EXPORT static void Poles (const BRepAdaptor_Curve& C, TColgp_Array1OfPnt& T);
145   
146   Standard_EXPORT static void PolesAndWeights (const BRepAdaptor_Curve& C, TColgp_Array1OfPnt& T, TColStd_Array1OfReal& W);
147   
148   Standard_EXPORT static Standard_Integer NbSamples (const BRepAdaptor_Curve& C, const Standard_Real U0, const Standard_Real U1);
149
150
151
152
153 protected:
154
155
156
157
158
159 private:
160
161
162
163
164
165 };
166
167
168 #include <HLRBRep_BCurveTool.lxx>
169
170
171
172
173
174 #endif // _HLRBRep_BCurveTool_HeaderFile