0031939: Coding - correction of spelling errors in comments [part 10]
[occt.git] / src / BRepGProp / BRepGProp.hxx
1 // Created on: 1992-12-04
2 // Created by: Isabelle GRIGNON
3 // Copyright (c) 1992-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 _BRepGProp_HeaderFile
18 #define _BRepGProp_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
23
24 #include <Standard_Real.hxx>
25 #include <Standard_Boolean.hxx>
26 #include <TColgp_Array1OfXYZ.hxx>
27
28 class TopoDS_Shape;
29 class GProp_GProps;
30 class gp_Pln;
31 class BRepGProp_EdgeTool;
32 class BRepGProp_Face;
33 class BRepGProp_Domain;
34 class BRepGProp_Cinert;
35 class BRepGProp_Sinert;
36 class BRepGProp_Vinert;
37 class BRepGProp_VinertGK;
38 class BRepGProp_UFunction;
39 class BRepGProp_TFunction;
40 class gp_XYZ;
41
42
43 //! Provides global functions to compute a shape's global
44 //! properties for lines, surfaces or volumes, and bring
45 //! them together with the global properties already
46 //! computed for a geometric system.
47 //! The global properties computed for a system are :
48 //! - its mass,
49 //! - its center of mass,
50 //! - its matrix of inertia,
51 //! - its moment about an axis,
52 //! - its radius of gyration about an axis,
53 //! - and its principal properties of inertia such as
54 //! principal axis, principal moments, principal radius of gyration.
55 class BRepGProp 
56 {
57 public:
58
59   DEFINE_STANDARD_ALLOC
60
61   
62   //! Computes the linear global properties of the shape S,
63   //! i.e. the global properties induced by each edge of the
64   //! shape S, and brings them together with the global
65   //! properties still retained by the framework LProps. If
66   //! the current system of LProps was empty, its global
67   //! properties become equal to the linear global
68   //! properties of S.
69   //! For this computation no linear density is attached to
70   //! the edges. So, for example, the added mass
71   //! corresponds to the sum of the lengths of the edges of
72   //! S. The density of the composed systems, i.e. that of
73   //! each component of the current system of LProps, and
74   //! that of S which is considered to be equal to 1, must be coherent.
75   //! Note that this coherence cannot be checked. You are
76   //! advised to use a separate framework for each
77   //! density, and then to bring these frameworks together
78   //! into a global one.
79   //! The point relative to which the inertia of the system is
80   //! computed is the reference point of the framework LProps.
81   //! Note: if your programming ensures that the framework
82   //! LProps retains only linear global properties (brought
83   //! together for example, by the function
84   //! LinearProperties) for objects the density of which is
85   //! equal to 1 (or is not defined), the function Mass will
86   //! return the total length of edges of the system analysed by LProps.
87   //! Warning
88   //! No check is performed to verify that the shape S
89   //! retains truly linear properties. If S is simply a vertex, it
90   //! is not considered to present any additional global properties.
91   //! SkipShared is a special flag, which allows taking in calculation 
92   //! shared topological entities or not.
93   //! For ex., if SkipShared = True, edges, shared by two or more faces, 
94   //! are taken into calculation only once.
95   //! If we have cube with sizes 1, 1, 1, its linear properties = 12 
96   //! for SkipEdges = true and 24 for SkipEdges = false.
97   //! UseTriangulation is a special flag, which defines preferable 
98   //! source of geometry data. If UseTriangulation = Standard_False,
99   //! exact geometry objects (curves) are used, otherwise polygons of 
100   //! triangulation are used first.
101   Standard_EXPORT static void LinearProperties(const TopoDS_Shape& S, GProp_GProps& LProps, 
102                                   const Standard_Boolean SkipShared = Standard_False,
103                                   const Standard_Boolean UseTriangulation = Standard_False);
104   
105   //! Computes the surface global properties of the
106   //! shape S, i.e. the global properties induced by each
107   //! face of the shape S, and brings them together with
108   //! the global properties still retained by the framework
109   //! SProps. If the current system of SProps was empty,
110   //! its global properties become equal to the surface
111   //! global properties of S.
112   //! For this computation, no surface density is attached
113   //! to the faces. Consequently, the added mass
114   //! corresponds to the sum of the areas of the faces of
115   //! S. The density of the component systems, i.e. that
116   //! of each component of the current system of
117   //! SProps, and that of S which is considered to be
118   //! equal to 1, must be coherent.
119   //! Note that this coherence cannot be checked. You
120   //! are advised to use a framework for each different
121   //! value of density, and then to bring these
122   //! frameworks together into a global one.
123   //! The point relative to which the inertia of the system
124   //! is computed is the reference point of the framework SProps.
125   //! Note : if your programming ensures that the
126   //! framework SProps retains only surface global
127   //! properties, brought together, for example, by the
128   //! function SurfaceProperties, for objects the density
129   //! of which is equal to 1 (or is not defined), the
130   //! function Mass will return the total area of faces of
131   //! the system analysed by SProps.
132   //! Warning
133   //! No check is performed to verify that the shape S
134   //! retains truly surface properties. If S is simply a
135   //! vertex, an edge or a wire, it is not considered to
136   //! present any additional global properties.
137   //! SkipShared is a special flag, which allows taking in calculation 
138   //! shared topological entities or not.
139   //! For ex., if SkipShared = True, faces, shared by two or more shells, 
140   //! are taken into calculation only once.
141   //! UseTriangulation is a special flag, which defines preferable 
142   //! source of geometry data. If UseTriangulation = Standard_False,
143   //! exact geometry objects (surfaces) are used, 
144   //! otherwise face triangulations are used first.
145   Standard_EXPORT static void SurfaceProperties(const TopoDS_Shape& S, GProp_GProps& SProps, 
146                                          const Standard_Boolean SkipShared = Standard_False,
147                                   const Standard_Boolean UseTriangulation = Standard_False);
148   
149   //! Updates <SProps> with the shape <S>, that contains its principal properties.
150   //! The surface properties of all the faces in <S> are computed.
151   //! Adaptive 2D Gauss integration is used.
152   //! Parameter Eps sets maximal relative error of computed mass (area) for each face.
153   //! Error is calculated as Abs((M(i+1)-M(i))/M(i+1)), M(i+1) and M(i) are values
154   //! for two successive steps of adaptive integration.
155   //! Method returns estimation of relative error reached for whole shape.
156   //! WARNING: if Eps > 0.001 algorithm performs non-adaptive integration.
157   //! SkipShared is a special flag, which allows taking in calculation 
158   //! shared topological entities or not
159   //! For ex., if SkipShared = True, faces, shared by two or more shells, 
160   //! are taken into calculation only once.
161   Standard_EXPORT static Standard_Real SurfaceProperties (const TopoDS_Shape& S, GProp_GProps& SProps,
162                         const Standard_Real Eps, const Standard_Boolean SkipShared = Standard_False);
163   //!
164   //! Computes the global volume properties of the solid
165   //! S, and brings them together with the global
166   //! properties still retained by the framework VProps. If
167   //! the current system of VProps was empty, its global
168   //! properties become equal to the global properties of S for volume.
169   //! For this computation, no volume density is attached
170   //! to the solid. Consequently, the added mass
171   //! corresponds to the volume of S. The density of the
172   //! component systems, i.e. that of each component of
173   //! the current system of VProps, and that of S which
174   //! is considered to be equal to 1, must be coherent to each other.
175   //! Note that this coherence cannot be checked. You
176   //! are advised to use a separate framework for each
177   //! density, and then to bring these frameworks
178   //! together into a global one.
179   //! The point relative to which the inertia of the system
180   //! is computed is the reference point of the framework VProps.
181   //! Note: if your programming ensures that the
182   //! framework VProps retains only global properties of
183   //! volume (brought together for example, by the
184   //! function VolumeProperties) for objects the density
185   //! of which is equal to 1 (or is not defined), the
186   //! function Mass will return the total volume of the
187   //! solids of the system analysed by VProps.
188   //! Warning
189   //! The shape S must represent an object whose
190   //! global volume properties can be computed. It may
191   //! be a finite solid, or a series of finite solids all
192   //! oriented in a coherent way. Nonetheless, S must be
193   //! exempt of any free boundary. Note that these
194   //! conditions of coherence are not checked by this
195   //! algorithm, and results will be false if they are not respected. 
196   //! SkipShared a is special flag, which allows taking in calculation 
197   //! shared topological entities or not.
198   //! For ex., if SkipShared = True, the volumes formed by the equal 
199   //! (the same TShape, location and orientation) faces are taken 
200   //! into calculation only once.
201   //! UseTriangulation is a special flag, which defines preferable
202   //! source of geometry data. If UseTriangulation = Standard_False,
203   //! exact geometry objects (surfaces) are used, 
204   //! otherwise face triangulations are used first.
205   Standard_EXPORT static void VolumeProperties(const TopoDS_Shape& S, GProp_GProps& VProps, 
206                                         const Standard_Boolean OnlyClosed = Standard_False, 
207                                         const Standard_Boolean SkipShared = Standard_False,
208                                  const Standard_Boolean UseTriangulation = Standard_False);
209   
210   //! Updates <VProps> with the shape <S>, that contains its principal properties.
211   //! The volume properties of all the FORWARD and REVERSED faces in <S> are computed.
212   //! If OnlyClosed is True then computed faces must belong to closed Shells.
213   //! Adaptive 2D Gauss integration is used.
214   //! Parameter Eps sets maximal relative error of computed mass (volume) for each face.
215   //! Error is calculated as Abs((M(i+1)-M(i))/M(i+1)), M(i+1) and M(i) are values
216   //! for two successive steps of adaptive integration.
217   //! Method returns estimation of relative error reached for whole shape.
218   //! WARNING: if Eps > 0.001 algorithm performs non-adaptive integration.
219   //! SkipShared is a special flag, which allows taking in calculation shared
220   //! topological entities or not.
221   //! For ex., if SkipShared = True, the volumes formed by the equal 
222   //! (the same TShape, location and orientation) 
223   //! faces are taken into calculation only once.
224   Standard_EXPORT static Standard_Real VolumeProperties (const TopoDS_Shape& S, GProp_GProps& VProps, 
225                          const Standard_Real Eps, const Standard_Boolean OnlyClosed = Standard_False, 
226                                                  const Standard_Boolean SkipShared = Standard_False);
227   
228   //! Updates <VProps> with the shape <S>, that contains its principal properties.
229   //! The volume properties of all the FORWARD and REVERSED faces in <S> are computed.
230   //! If OnlyClosed is True then computed faces must belong to closed Shells.
231   //! Adaptive 2D Gauss integration is used.
232   //! Parameter IsUseSpan says if it is necessary to define spans on a face.
233   //! This option has an effect only for BSpline faces.
234   //! Parameter Eps sets maximal relative error of computed property for each face.
235   //! Error is delivered by the adaptive Gauss-Kronrod method of integral computation
236   //! that is used for properties computation.
237   //! Method returns estimation of relative error reached for whole shape.
238   //! Returns negative value if the computation is failed.
239   //! SkipShared is a special flag, which allows taking in calculation
240   //! shared topological entities or not.
241   //! For ex., if SkipShared = True, the volumes formed by the equal 
242   //! (the same TShape, location and orientation) faces are taken into calculation only once.
243   Standard_EXPORT static Standard_Real VolumePropertiesGK (const TopoDS_Shape& S, 
244     GProp_GProps& VProps, 
245     const Standard_Real Eps = 0.001, 
246     const Standard_Boolean OnlyClosed = Standard_False, 
247     const Standard_Boolean IsUseSpan = Standard_False, 
248     const Standard_Boolean CGFlag = Standard_False, 
249     const Standard_Boolean IFlag = Standard_False, 
250     const Standard_Boolean SkipShared = Standard_False);
251   
252   Standard_EXPORT static Standard_Real VolumePropertiesGK (const TopoDS_Shape& S, 
253     GProp_GProps& VProps, 
254     const gp_Pln& thePln, const Standard_Real Eps = 0.001, 
255     const Standard_Boolean OnlyClosed = Standard_False, 
256     const Standard_Boolean IsUseSpan = Standard_False, 
257     const Standard_Boolean CGFlag = Standard_False, 
258     const Standard_Boolean IFlag = Standard_False, 
259     const Standard_Boolean SkipShared = Standard_False);
260
261
262 protected:
263
264
265
266
267
268 private:
269
270
271
272
273 friend class BRepGProp_EdgeTool;
274 friend class BRepGProp_Face;
275 friend class BRepGProp_Domain;
276 friend class BRepGProp_Cinert;
277 friend class BRepGProp_Sinert;
278 friend class BRepGProp_Vinert;
279 friend class BRepGProp_VinertGK;
280 friend class BRepGProp_UFunction;
281 friend class BRepGProp_TFunction;
282
283 };
284
285
286
287
288
289
290
291 #endif // _BRepGProp_HeaderFile