42cf5bc1 |
1 | // Created on: 1993-03-31 |
2 | // Created by: Bruno DUMORTIER |
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 _Adaptor3d_Surface_HeaderFile |
18 | #define _Adaptor3d_Surface_HeaderFile |
19 | |
c22b52d6 |
20 | #include <Adaptor3d_Curve.hxx> |
21 | #include <GeomAbs_Shape.hxx> |
22 | #include <GeomAbs_SurfaceType.hxx> |
23 | #include <gp_Ax1.hxx> |
24 | #include <gp_Cylinder.hxx> |
25 | #include <gp_Cone.hxx> |
26 | #include <gp_Pln.hxx> |
27 | #include <gp_Sphere.hxx> |
28 | #include <gp_Torus.hxx> |
42cf5bc1 |
29 | #include <Standard.hxx> |
30 | #include <Standard_DefineAlloc.hxx> |
31 | #include <Standard_Handle.hxx> |
42cf5bc1 |
32 | #include <TColStd_Array1OfReal.hxx> |
c22b52d6 |
33 | |
42cf5bc1 |
34 | class Geom_BezierSurface; |
35 | class Geom_BSplineSurface; |
42cf5bc1 |
36 | |
c22b52d6 |
37 | DEFINE_STANDARD_HANDLE(Adaptor3d_Surface, Standard_Transient) |
42cf5bc1 |
38 | |
39 | //! Root class for surfaces on which geometric algorithms work. |
40 | //! An adapted surface is an interface between the |
41 | //! services provided by a surface and those required of |
42 | //! the surface by algorithms which use it. |
43 | //! A derived concrete class is provided: |
44 | //! GeomAdaptor_Surface for a surface from the Geom package. |
45 | //! The Surface class describes the standard behaviour |
46 | //! of a surface for generic algorithms. |
47 | //! |
48 | //! The Surface can be decomposed in intervals of any |
b81b237f |
49 | //! continuity in U and V using the method NbIntervals. |
50 | //! A current interval can be set. |
51 | //! Most of the methods apply to the current interval. |
42cf5bc1 |
52 | //! Warning: All the methods are virtual and implemented with a |
b81b237f |
53 | //! raise to allow to redefined only the methods really used. |
34e4e9f2 |
54 | //! |
b81b237f |
55 | //! Polynomial coefficients of BSpline surfaces used for their evaluation are cached for better performance. |
56 | //! Therefore these evaluations are not thread-safe and parallel evaluations need to be prevented. |
c22b52d6 |
57 | class Adaptor3d_Surface : public Standard_Transient |
42cf5bc1 |
58 | { |
c22b52d6 |
59 | DEFINE_STANDARD_RTTIEXT(Adaptor3d_Surface, Standard_Transient) |
42cf5bc1 |
60 | public: |
61 | |
872a7e3a |
62 | //! Shallow copy of adaptor |
63 | Standard_EXPORT virtual Handle(Adaptor3d_Surface) ShallowCopy() const; |
64 | |
42cf5bc1 |
65 | Standard_EXPORT virtual Standard_Real FirstUParameter() const; |
66 | |
67 | Standard_EXPORT virtual Standard_Real LastUParameter() const; |
68 | |
69 | Standard_EXPORT virtual Standard_Real FirstVParameter() const; |
70 | |
71 | Standard_EXPORT virtual Standard_Real LastVParameter() const; |
72 | |
73 | Standard_EXPORT virtual GeomAbs_Shape UContinuity() const; |
74 | |
75 | Standard_EXPORT virtual GeomAbs_Shape VContinuity() const; |
76 | |
77 | //! Returns the number of U intervals for continuity |
78 | //! <S>. May be one if UContinuity(me) >= <S> |
79 | Standard_EXPORT virtual Standard_Integer NbUIntervals (const GeomAbs_Shape S) const; |
80 | |
81 | //! Returns the number of V intervals for continuity |
82 | //! <S>. May be one if VContinuity(me) >= <S> |
83 | Standard_EXPORT virtual Standard_Integer NbVIntervals (const GeomAbs_Shape S) const; |
84 | |
85 | //! Returns the intervals with the requested continuity |
86 | //! in the U direction. |
87 | Standard_EXPORT virtual void UIntervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const; |
88 | |
89 | //! Returns the intervals with the requested continuity |
90 | //! in the V direction. |
91 | Standard_EXPORT virtual void VIntervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const; |
92 | |
93 | //! Returns a surface trimmed in the U direction |
94 | //! equivalent of <me> between |
95 | //! parameters <First> and <Last>. <Tol> is used to |
96 | //! test for 3d points confusion. |
97 | //! If <First> >= <Last> |
c22b52d6 |
98 | Standard_EXPORT virtual Handle(Adaptor3d_Surface) UTrim (const Standard_Real First, const Standard_Real Last, const Standard_Real Tol) const; |
42cf5bc1 |
99 | |
100 | //! Returns a surface trimmed in the V direction between |
101 | //! parameters <First> and <Last>. <Tol> is used to |
102 | //! test for 3d points confusion. |
103 | //! If <First> >= <Last> |
c22b52d6 |
104 | Standard_EXPORT virtual Handle(Adaptor3d_Surface) VTrim (const Standard_Real First, const Standard_Real Last, const Standard_Real Tol) const; |
42cf5bc1 |
105 | |
106 | Standard_EXPORT virtual Standard_Boolean IsUClosed() const; |
107 | |
108 | Standard_EXPORT virtual Standard_Boolean IsVClosed() const; |
109 | |
110 | Standard_EXPORT virtual Standard_Boolean IsUPeriodic() const; |
111 | |
112 | Standard_EXPORT virtual Standard_Real UPeriod() const; |
113 | |
114 | Standard_EXPORT virtual Standard_Boolean IsVPeriodic() const; |
115 | |
116 | Standard_EXPORT virtual Standard_Real VPeriod() const; |
a9e5f650 |
117 | |
42cf5bc1 |
118 | //! Computes the point of parameters U,V on the surface. |
a9e5f650 |
119 | //! Tip: use GeomLib::NormEstim() to calculate surface normal at specified (U, V) point. |
42cf5bc1 |
120 | Standard_EXPORT virtual gp_Pnt Value (const Standard_Real U, const Standard_Real V) const; |
a9e5f650 |
121 | |
42cf5bc1 |
122 | //! Computes the point of parameters U,V on the surface. |
123 | Standard_EXPORT virtual void D0 (const Standard_Real U, const Standard_Real V, gp_Pnt& P) const; |
124 | |
a9e5f650 |
125 | //! Computes the point and the first derivatives on the surface. |
126 | //! Raised if the continuity of the current intervals is not C1. |
127 | //! |
128 | //! Tip: use GeomLib::NormEstim() to calculate surface normal at specified (U, V) point. |
42cf5bc1 |
129 | Standard_EXPORT virtual void D1 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V) const; |
a9e5f650 |
130 | |
42cf5bc1 |
131 | //! Computes the point, the first and second |
132 | //! derivatives on the surface. |
133 | //! Raised if the continuity of the current |
134 | //! intervals is not C2. |
135 | Standard_EXPORT virtual void D2 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V, gp_Vec& D2U, gp_Vec& D2V, gp_Vec& D2UV) const; |
136 | |
137 | //! Computes the point, the first, second and third |
138 | //! derivatives on the surface. |
139 | //! Raised if the continuity of the current |
140 | //! intervals is not C3. |
141 | Standard_EXPORT virtual void D3 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V, gp_Vec& D2U, gp_Vec& D2V, gp_Vec& D2UV, gp_Vec& D3U, gp_Vec& D3V, gp_Vec& D3UUV, gp_Vec& D3UVV) const; |
142 | |
143 | //! Computes the derivative of order Nu in the direction U and Nv |
144 | //! in the direction V at the point P(U, V). |
145 | //! Raised if the current U interval is not not CNu |
146 | //! and the current V interval is not CNv. |
147 | //! Raised if Nu + Nv < 1 or Nu < 0 or Nv < 0. |
148 | Standard_EXPORT virtual gp_Vec DN (const Standard_Real U, const Standard_Real V, const Standard_Integer Nu, const Standard_Integer Nv) const; |
149 | |
150 | //! Returns the parametric U resolution corresponding |
151 | //! to the real space resolution <R3d>. |
152 | Standard_EXPORT virtual Standard_Real UResolution (const Standard_Real R3d) const; |
153 | |
154 | //! Returns the parametric V resolution corresponding |
155 | //! to the real space resolution <R3d>. |
156 | Standard_EXPORT virtual Standard_Real VResolution (const Standard_Real R3d) const; |
157 | |
158 | //! Returns the type of the surface : Plane, Cylinder, |
159 | //! Cone, Sphere, Torus, BezierSurface, |
160 | //! BSplineSurface, SurfaceOfRevolution, |
161 | //! SurfaceOfExtrusion, OtherSurface |
162 | Standard_EXPORT virtual GeomAbs_SurfaceType GetType() const; |
163 | |
164 | Standard_EXPORT virtual gp_Pln Plane() const; |
165 | |
166 | Standard_EXPORT virtual gp_Cylinder Cylinder() const; |
167 | |
168 | Standard_EXPORT virtual gp_Cone Cone() const; |
169 | |
170 | Standard_EXPORT virtual gp_Sphere Sphere() const; |
171 | |
172 | Standard_EXPORT virtual gp_Torus Torus() const; |
173 | |
174 | Standard_EXPORT virtual Standard_Integer UDegree() const; |
175 | |
176 | Standard_EXPORT virtual Standard_Integer NbUPoles() const; |
177 | |
178 | Standard_EXPORT virtual Standard_Integer VDegree() const; |
179 | |
180 | Standard_EXPORT virtual Standard_Integer NbVPoles() const; |
181 | |
182 | Standard_EXPORT virtual Standard_Integer NbUKnots() const; |
183 | |
184 | Standard_EXPORT virtual Standard_Integer NbVKnots() const; |
185 | |
186 | Standard_EXPORT virtual Standard_Boolean IsURational() const; |
187 | |
188 | Standard_EXPORT virtual Standard_Boolean IsVRational() const; |
189 | |
190 | Standard_EXPORT virtual Handle(Geom_BezierSurface) Bezier() const; |
191 | |
192 | Standard_EXPORT virtual Handle(Geom_BSplineSurface) BSpline() const; |
193 | |
194 | Standard_EXPORT virtual gp_Ax1 AxeOfRevolution() const; |
195 | |
196 | Standard_EXPORT virtual gp_Dir Direction() const; |
197 | |
c22b52d6 |
198 | Standard_EXPORT virtual Handle(Adaptor3d_Curve) BasisCurve() const; |
42cf5bc1 |
199 | |
c22b52d6 |
200 | Standard_EXPORT virtual Handle(Adaptor3d_Surface) BasisSurface() const; |
42cf5bc1 |
201 | |
202 | Standard_EXPORT virtual Standard_Real OffsetValue() const; |
203 | Standard_EXPORT virtual ~Adaptor3d_Surface(); |
204 | |
42cf5bc1 |
205 | }; |
206 | |
42cf5bc1 |
207 | #endif // _Adaptor3d_Surface_HeaderFile |