42cf5bc1 |
1 | // Created on: 1993-04-07 |
2 | // Created by: Laurent BUCHARD |
3 | // Copyright (c) 1993-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 _IntCurveSurface_TheHCurveTool_HeaderFile |
18 | #define _IntCurveSurface_TheHCurveTool_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 <TColStd_HArray1OfReal.hxx> |
38 | class Standard_OutOfRange; |
39 | class Standard_NoSuchObject; |
40 | class Standard_DomainError; |
41 | class Adaptor3d_HCurve; |
42 | class gp_Pnt; |
43 | class gp_Vec; |
44 | class Geom_BezierCurve; |
45 | class Geom_BSplineCurve; |
46 | |
47 | |
48 | |
49 | class IntCurveSurface_TheHCurveTool |
50 | { |
51 | public: |
52 | |
53 | DEFINE_STANDARD_ALLOC |
54 | |
55 | |
56 | static Standard_Real FirstParameter (const Handle(Adaptor3d_HCurve)& C); |
57 | |
58 | static Standard_Real LastParameter (const Handle(Adaptor3d_HCurve)& C); |
59 | |
60 | static GeomAbs_Shape Continuity (const Handle(Adaptor3d_HCurve)& C); |
61 | |
36b9ff75 |
62 | //! Returns the number of intervals for continuity |
63 | //! <S>. May be one if Continuity(myclass) >= <S> |
42cf5bc1 |
64 | static Standard_Integer NbIntervals (const Handle(Adaptor3d_HCurve)& C, const GeomAbs_Shape S); |
65 | |
36b9ff75 |
66 | //! Stores in <T> the parameters bounding the intervals |
67 | //! of continuity <S>. |
68 | //! |
21c7c457 |
69 | //! The array must provide enough room to accommodate |
36b9ff75 |
70 | //! for the parameters. i.e. T.Length() > NbIntervals() |
42cf5bc1 |
71 | static void Intervals (const Handle(Adaptor3d_HCurve)& C, TColStd_Array1OfReal& T, const GeomAbs_Shape S); |
72 | |
73 | static Standard_Boolean IsClosed (const Handle(Adaptor3d_HCurve)& C); |
74 | |
75 | static Standard_Boolean IsPeriodic (const Handle(Adaptor3d_HCurve)& C); |
76 | |
77 | static Standard_Real Period (const Handle(Adaptor3d_HCurve)& C); |
78 | |
36b9ff75 |
79 | //! Computes the point of parameter U on the curve. |
42cf5bc1 |
80 | static gp_Pnt Value (const Handle(Adaptor3d_HCurve)& C, const Standard_Real U); |
81 | |
36b9ff75 |
82 | //! Computes the point of parameter U on the curve. |
42cf5bc1 |
83 | static void D0 (const Handle(Adaptor3d_HCurve)& C, const Standard_Real U, gp_Pnt& P); |
84 | |
36b9ff75 |
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. |
42cf5bc1 |
89 | static void D1 (const Handle(Adaptor3d_HCurve)& C, const Standard_Real U, gp_Pnt& P, gp_Vec& V); |
90 | |
36b9ff75 |
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. |
42cf5bc1 |
96 | static void D2 (const Handle(Adaptor3d_HCurve)& C, const Standard_Real U, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2); |
97 | |
36b9ff75 |
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. |
42cf5bc1 |
103 | static void D3 (const Handle(Adaptor3d_HCurve)& C, const Standard_Real U, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2, gp_Vec& V3); |
104 | |
36b9ff75 |
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. |
42cf5bc1 |
111 | static gp_Vec DN (const Handle(Adaptor3d_HCurve)& C, const Standard_Real U, const Standard_Integer N); |
112 | |
36b9ff75 |
113 | //! Returns the parametric resolution corresponding |
114 | //! to the real space resolution <R3d>. |
42cf5bc1 |
115 | static Standard_Real Resolution (const Handle(Adaptor3d_HCurve)& C, const Standard_Real R3d); |
116 | |
36b9ff75 |
117 | //! Returns the type of the curve in the current |
118 | //! interval : Line, Circle, Ellipse, Hyperbola, |
119 | //! Parabola, BezierCurve, BSplineCurve, OtherCurve. |
42cf5bc1 |
120 | static GeomAbs_CurveType GetType (const Handle(Adaptor3d_HCurve)& C); |
121 | |
122 | static gp_Lin Line (const Handle(Adaptor3d_HCurve)& C); |
123 | |
124 | static gp_Circ Circle (const Handle(Adaptor3d_HCurve)& C); |
125 | |
126 | static gp_Elips Ellipse (const Handle(Adaptor3d_HCurve)& C); |
127 | |
128 | static gp_Hypr Hyperbola (const Handle(Adaptor3d_HCurve)& C); |
129 | |
130 | static gp_Parab Parabola (const Handle(Adaptor3d_HCurve)& C); |
131 | |
132 | static Handle(Geom_BezierCurve) Bezier (const Handle(Adaptor3d_HCurve)& C); |
133 | |
134 | static Handle(Geom_BSplineCurve) BSpline (const Handle(Adaptor3d_HCurve)& C); |
135 | |
136 | Standard_EXPORT static Standard_Integer NbSamples (const Handle(Adaptor3d_HCurve)& C, const Standard_Real U0, const Standard_Real U1); |
137 | |
138 | Standard_EXPORT static void SamplePars (const Handle(Adaptor3d_HCurve)& C, const Standard_Real U0, const Standard_Real U1, const Standard_Real Defl, const Standard_Integer NbMin, Handle(TColStd_HArray1OfReal)& Pars); |
139 | |
140 | |
141 | |
142 | |
143 | protected: |
144 | |
145 | |
146 | |
147 | |
148 | |
149 | private: |
150 | |
151 | |
152 | |
153 | |
154 | |
155 | }; |
156 | |
157 | #define CurveGen Handle(Adaptor3d_HCurve) |
158 | #define CurveGen_hxx <Adaptor3d_HCurve.hxx> |
159 | #define IntCurveSurface_HCurveTool IntCurveSurface_TheHCurveTool |
160 | #define IntCurveSurface_HCurveTool_hxx <IntCurveSurface_TheHCurveTool.hxx> |
161 | |
162 | #include <IntCurveSurface_HCurveTool.lxx> |
163 | |
164 | #undef CurveGen |
165 | #undef CurveGen_hxx |
166 | #undef IntCurveSurface_HCurveTool |
167 | #undef IntCurveSurface_HCurveTool_hxx |
168 | |
169 | |
170 | |
171 | |
172 | #endif // _IntCurveSurface_TheHCurveTool_HeaderFile |