42cf5bc1 |
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> |
42cf5bc1 |
38 | class BRepAdaptor_Curve; |
39 | class gp_Pnt; |
40 | class gp_Vec; |
41 | class Geom_BezierCurve; |
42 | class Geom_BSplineCurve; |
43 | |
44 | |
45 | |
46 | class HLRBRep_BCurveTool |
47 | { |
48 | public: |
49 | |
50 | DEFINE_STANDARD_ALLOC |
51 | |
52 | |
53 | static Standard_Real FirstParameter (const BRepAdaptor_Curve& C); |
54 | |
55 | static Standard_Real LastParameter (const BRepAdaptor_Curve& C); |
56 | |
57 | static GeomAbs_Shape Continuity (const BRepAdaptor_Curve& C); |
58 | |
59 | //! Returns the number of intervals for continuity |
60 | //! <S>. May be one if Continuity(myclass) >= <S> |
61 | static Standard_Integer NbIntervals (const BRepAdaptor_Curve& C, const GeomAbs_Shape S); |
62 | |
63 | //! Stores in <T> the parameters bounding the intervals |
64 | //! of continuity <S>. |
65 | //! |
21c7c457 |
66 | //! The array must provide enough room to accommodate |
42cf5bc1 |
67 | //! for the parameters. i.e. T.Length() > NbIntervals() |
68 | static void Intervals (const BRepAdaptor_Curve& C, TColStd_Array1OfReal& T, const GeomAbs_Shape S); |
69 | |
70 | static Standard_Boolean IsClosed (const BRepAdaptor_Curve& C); |
71 | |
72 | static Standard_Boolean IsPeriodic (const BRepAdaptor_Curve& C); |
73 | |
74 | static Standard_Real Period (const BRepAdaptor_Curve& C); |
75 | |
76 | //! Computes the point of parameter U on the curve. |
77 | static gp_Pnt Value (const BRepAdaptor_Curve& C, const Standard_Real U); |
78 | |
79 | //! Computes the point of parameter U on the curve. |
80 | static void D0 (const BRepAdaptor_Curve& C, const Standard_Real U, gp_Pnt& P); |
81 | |
82 | //! Computes the point of parameter U on the curve with its |
83 | //! first derivative. |
84 | //! Raised if the continuity of the current interval |
85 | //! is not C1. |
86 | static void D1 (const BRepAdaptor_Curve& C, const Standard_Real U, gp_Pnt& P, gp_Vec& V); |
87 | |
88 | |
89 | //! Returns the point P of parameter U, the first and second |
90 | //! derivatives V1 and V2. |
91 | //! Raised if the continuity of the current interval |
92 | //! is not C2. |
93 | static void D2 (const BRepAdaptor_Curve& C, const Standard_Real U, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2); |
94 | |
95 | |
96 | //! Returns the point P of parameter U, the first, the second |
97 | //! and the third derivative. |
98 | //! Raised if the continuity of the current interval |
99 | //! is not C3. |
100 | static void D3 (const BRepAdaptor_Curve& C, const Standard_Real U, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2, gp_Vec& V3); |
101 | |
102 | |
103 | //! The returned vector gives the value of the derivative for the |
104 | //! order of derivation N. |
105 | //! Raised if the continuity of the current interval |
106 | //! is not CN. |
107 | //! Raised if N < 1. |
108 | static gp_Vec DN (const BRepAdaptor_Curve& C, const Standard_Real U, const Standard_Integer N); |
109 | |
110 | //! Returns the parametric resolution corresponding |
111 | //! to the real space resolution <R3d>. |
112 | static Standard_Real Resolution (const BRepAdaptor_Curve& C, const Standard_Real R3d); |
113 | |
114 | //! Returns the type of the curve in the current |
115 | //! interval : Line, Circle, Ellipse, Hyperbola, |
116 | //! Parabola, BezierCurve, BSplineCurve, OtherCurve. |
117 | static GeomAbs_CurveType GetType (const BRepAdaptor_Curve& C); |
118 | |
119 | static gp_Lin Line (const BRepAdaptor_Curve& C); |
120 | |
121 | static gp_Circ Circle (const BRepAdaptor_Curve& C); |
122 | |
123 | static gp_Elips Ellipse (const BRepAdaptor_Curve& C); |
124 | |
125 | static gp_Hypr Hyperbola (const BRepAdaptor_Curve& C); |
126 | |
127 | static gp_Parab Parabola (const BRepAdaptor_Curve& C); |
128 | |
129 | Standard_EXPORT static Handle(Geom_BezierCurve) Bezier (const BRepAdaptor_Curve& C); |
130 | |
131 | Standard_EXPORT static Handle(Geom_BSplineCurve) BSpline (const BRepAdaptor_Curve& C); |
132 | |
133 | static Standard_Integer Degree (const BRepAdaptor_Curve& C); |
134 | |
135 | static Standard_Boolean IsRational (const BRepAdaptor_Curve& C); |
136 | |
137 | static Standard_Integer NbPoles (const BRepAdaptor_Curve& C); |
138 | |
139 | static Standard_Integer NbKnots (const BRepAdaptor_Curve& C); |
140 | |
141 | Standard_EXPORT static void Poles (const BRepAdaptor_Curve& C, TColgp_Array1OfPnt& T); |
142 | |
143 | Standard_EXPORT static void PolesAndWeights (const BRepAdaptor_Curve& C, TColgp_Array1OfPnt& T, TColStd_Array1OfReal& W); |
144 | |
145 | Standard_EXPORT static Standard_Integer NbSamples (const BRepAdaptor_Curve& C, const Standard_Real U0, const Standard_Real U1); |
146 | |
147 | |
148 | |
149 | |
150 | protected: |
151 | |
152 | |
153 | |
154 | |
155 | |
156 | private: |
157 | |
158 | |
159 | |
160 | |
161 | |
162 | }; |
163 | |
164 | |
165 | #include <HLRBRep_BCurveTool.lxx> |
166 | |
167 | |
168 | |
169 | |
170 | |
171 | #endif // _HLRBRep_BCurveTool_HeaderFile |