0031682: Visualization - Prs3d_ShadingAspect::SetTransparency() has no effect with...
[occt.git] / src / BRepAdaptor / BRepAdaptor_Surface.hxx
CommitLineData
42cf5bc1 1// Created on: 1993-02-22
2// Created by: Remi LEQUETTE
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 _BRepAdaptor_Surface_HeaderFile
18#define _BRepAdaptor_Surface_HeaderFile
19
20#include <Standard.hxx>
21#include <Standard_DefineAlloc.hxx>
22#include <Standard_Handle.hxx>
23
24#include <GeomAdaptor_Surface.hxx>
25#include <gp_Trsf.hxx>
26#include <TopoDS_Face.hxx>
27#include <Adaptor3d_Surface.hxx>
28#include <Standard_Boolean.hxx>
29#include <Standard_Real.hxx>
30#include <GeomAbs_Shape.hxx>
31#include <Standard_Integer.hxx>
32#include <TColStd_Array1OfReal.hxx>
33#include <GeomAbs_SurfaceType.hxx>
34class Standard_OutOfRange;
35class Standard_DomainError;
36class Standard_NoSuchObject;
37class TopoDS_Face;
38class GeomAdaptor_Surface;
39class gp_Trsf;
40class Adaptor3d_HSurface;
41class gp_Pnt;
42class gp_Vec;
43class gp_Pln;
44class gp_Cylinder;
45class gp_Cone;
46class gp_Sphere;
47class gp_Torus;
48class Geom_BezierSurface;
49class Geom_BSplineSurface;
50class gp_Ax1;
51class gp_Dir;
52class Adaptor3d_HCurve;
53
54
55//! The Surface from BRepAdaptor allows to use a Face
56//! of the BRep topology look like a 3D surface.
57//!
58//! It has the methods of the class Surface from
59//! Adaptor3d.
60//!
61//! It is created or initialized with a Face. It takes
62//! into account the local coordinates system.
63//!
64//! The u,v parameter range is the minmax value for
65//! the restriction, unless the flag restriction is
66//! set to false.
67class BRepAdaptor_Surface : public Adaptor3d_Surface
68{
69public:
70
71 DEFINE_STANDARD_ALLOC
72
73
74 //! Creates an undefined surface with no face loaded.
75 Standard_EXPORT BRepAdaptor_Surface();
76
77 //! Creates a surface to access the geometry of <F>.
78 //! If <Restriction> is true the parameter range is
79 //! the parameter range in the UV space of the
80 //! restriction.
81 Standard_EXPORT BRepAdaptor_Surface(const TopoDS_Face& F, const Standard_Boolean R = Standard_True);
82
83 //! Sets the surface to the geometry of <F>.
84 Standard_EXPORT void Initialize (const TopoDS_Face& F, const Standard_Boolean Restriction = Standard_True);
85
86 //! Returns the surface.
87 Standard_EXPORT const GeomAdaptor_Surface& Surface() const;
88
89 //! Returns the surface.
90 Standard_EXPORT GeomAdaptor_Surface& ChangeSurface();
91
92 //! Returns the surface coordinate system.
93 Standard_EXPORT const gp_Trsf& Trsf() const;
94
95 //! Returns the face.
96 Standard_EXPORT const TopoDS_Face& Face() const;
97
98 //! Returns the face tolerance.
99 Standard_EXPORT Standard_Real Tolerance() const;
100
101 Standard_Real FirstUParameter() const Standard_OVERRIDE;
102
103 Standard_Real LastUParameter() const Standard_OVERRIDE;
104
105 Standard_Real FirstVParameter() const Standard_OVERRIDE;
106
107 Standard_Real LastVParameter() const Standard_OVERRIDE;
108
109 GeomAbs_Shape UContinuity() const Standard_OVERRIDE;
110
111 GeomAbs_Shape VContinuity() const Standard_OVERRIDE;
112
113 //! If necessary, breaks the surface in U intervals of
114 //! continuity <S>. And returns the number of
115 //! intervals.
116 Standard_Integer NbUIntervals (const GeomAbs_Shape S) const Standard_OVERRIDE;
117
118 //! If necessary, breaks the surface in V intervals of
119 //! continuity <S>. And returns the number of
120 //! intervals.
121 Standard_Integer NbVIntervals (const GeomAbs_Shape S) const Standard_OVERRIDE;
122
123 //! Returns the intervals with the requested continuity
124 //! in the U direction.
125 Standard_EXPORT void UIntervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const Standard_OVERRIDE;
126
127 //! Returns the intervals with the requested continuity
128 //! in the V direction.
129 Standard_EXPORT void VIntervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const Standard_OVERRIDE;
130
131 //! Returns a surface trimmed in the U direction
132 //! equivalent of <me> between
133 //! parameters <First> and <Last>. <Tol> is used to
134 //! test for 3d points confusion.
135 //! If <First> >= <Last>
136 Standard_EXPORT Handle(Adaptor3d_HSurface) UTrim (const Standard_Real First, const Standard_Real Last, const Standard_Real Tol) const Standard_OVERRIDE;
137
138 //! Returns a surface trimmed in the V direction between
139 //! parameters <First> and <Last>. <Tol> is used to
140 //! test for 3d points confusion.
141 //! If <First> >= <Last>
142 Standard_EXPORT Handle(Adaptor3d_HSurface) VTrim (const Standard_Real First, const Standard_Real Last, const Standard_Real Tol) const Standard_OVERRIDE;
143
144 Standard_Boolean IsUClosed() const Standard_OVERRIDE;
145
146 Standard_Boolean IsVClosed() const Standard_OVERRIDE;
147
148 Standard_Boolean IsUPeriodic() const Standard_OVERRIDE;
149
150 Standard_Real UPeriod() const Standard_OVERRIDE;
151
152 Standard_Boolean IsVPeriodic() const Standard_OVERRIDE;
153
154 Standard_Real VPeriod() const Standard_OVERRIDE;
155
156 //! Computes the point of parameters U,V on the surface.
157 Standard_EXPORT gp_Pnt Value (const Standard_Real U, const Standard_Real V) const Standard_OVERRIDE;
158
159 //! Computes the point of parameters U,V on the surface.
160 Standard_EXPORT void D0 (const Standard_Real U, const Standard_Real V, gp_Pnt& P) const Standard_OVERRIDE;
161
162 //! Computes the point and the first derivatives on
163 //! the surface.
164 //! Raised if the continuity of the current
165 //! intervals is not C1.
166 Standard_EXPORT void D1 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V) const Standard_OVERRIDE;
167
168 //! Computes the point, the first and second
169 //! derivatives on the surface.
170 //! Raised if the continuity of the current
171 //! intervals is not C2.
172 Standard_EXPORT 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 Standard_OVERRIDE;
173
174 //! Computes the point, the first, second and third
175 //! derivatives on the surface.
176 //! Raised if the continuity of the current
177 //! intervals is not C3.
178 Standard_EXPORT 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 Standard_OVERRIDE;
179
180 //! Computes the derivative of order Nu in the direction
181 //! U and Nv in the direction V at the point P(U, V).
182 //! Raised if the current U interval is not not CNu
183 //! and the current V interval is not CNv.
184 //! Raised if Nu + Nv < 1 or Nu < 0 or Nv < 0.
185 Standard_EXPORT gp_Vec DN (const Standard_Real U, const Standard_Real V, const Standard_Integer Nu, const Standard_Integer Nv) const Standard_OVERRIDE;
186
187 //! Returns the parametric U resolution corresponding
188 //! to the real space resolution <R3d>.
189 Standard_Real UResolution (const Standard_Real R3d) const Standard_OVERRIDE;
190
191 //! Returns the parametric V resolution corresponding
192 //! to the real space resolution <R3d>.
193 Standard_Real VResolution (const Standard_Real R3d) const Standard_OVERRIDE;
194
195 //! Returns the type of the surface : Plane, Cylinder,
196 //! Cone, Sphere, Torus, BezierSurface,
197 //! BSplineSurface, SurfaceOfRevolution,
198 //! SurfaceOfExtrusion, OtherSurface
199 GeomAbs_SurfaceType GetType() const Standard_OVERRIDE;
200
201 Standard_EXPORT gp_Pln Plane() const Standard_OVERRIDE;
202
203 Standard_EXPORT gp_Cylinder Cylinder() const Standard_OVERRIDE;
204
205 Standard_EXPORT gp_Cone Cone() const Standard_OVERRIDE;
206
207 Standard_EXPORT gp_Sphere Sphere() const Standard_OVERRIDE;
208
209 Standard_EXPORT gp_Torus Torus() const Standard_OVERRIDE;
210
211 Standard_Integer UDegree() const Standard_OVERRIDE;
212
213 Standard_Integer NbUPoles() const Standard_OVERRIDE;
214
215 Standard_Integer VDegree() const Standard_OVERRIDE;
216
217 Standard_Integer NbVPoles() const Standard_OVERRIDE;
218
219 Standard_Integer NbUKnots() const Standard_OVERRIDE;
220
221 Standard_Integer NbVKnots() const Standard_OVERRIDE;
222
223 Standard_Boolean IsURational() const Standard_OVERRIDE;
224
225 Standard_Boolean IsVRational() const Standard_OVERRIDE;
226
227 Standard_EXPORT Handle(Geom_BezierSurface) Bezier() const Standard_OVERRIDE;
228
229
230 //! Warning : this will make a copy of the
231 //! BSpline Surface since it applies
232 //! to it the myTsrf transformation
233 //! Be Carefull when using this method
234 Standard_EXPORT Handle(Geom_BSplineSurface) BSpline() const Standard_OVERRIDE;
235
236 Standard_EXPORT gp_Ax1 AxeOfRevolution() const Standard_OVERRIDE;
237
238 Standard_EXPORT gp_Dir Direction() const Standard_OVERRIDE;
239
240 //! only for SurfaceOfExtrusion and SurfaceOfRevolution
241 //! Warning: this will make a copy of the underlying curve
242 //! since it applies to it the transformation
243 //! myTrsf. Be carefull when using this method.
244 Standard_EXPORT Handle(Adaptor3d_HCurve) BasisCurve() const Standard_OVERRIDE;
245
246 Standard_EXPORT Handle(Adaptor3d_HSurface) BasisSurface() const Standard_OVERRIDE;
247
248 Standard_EXPORT Standard_Real OffsetValue() const Standard_OVERRIDE;
249
250
251
252
253protected:
254
255
256
257
258
259private:
260
261
262
263 GeomAdaptor_Surface mySurf;
264 gp_Trsf myTrsf;
265 TopoDS_Face myFace;
266
267
268};
269
270
271#include <BRepAdaptor_Surface.lxx>
272
273
274
275
276
277#endif // _BRepAdaptor_Surface_HeaderFile