42cf5bc1 |
1 | // Created on: 2005-12-21 |
2 | // Created by: Sergey KHROMOV |
3 | // Copyright (c) 2005-2014 OPEN CASCADE SAS |
4 | // |
5 | // This file is part of Open CASCADE Technology software library. |
6 | // |
7 | // This library is free software; you can redistribute it and/or modify it under |
8 | // the terms of the GNU Lesser General Public License version 2.1 as published |
9 | // by the Free Software Foundation, with special exception defined in the file |
10 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
11 | // distribution for complete text of the license and disclaimer of any warranty. |
12 | // |
13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. |
15 | |
16 | #ifndef _BRepGProp_VinertGK_HeaderFile |
17 | #define _BRepGProp_VinertGK_HeaderFile |
18 | |
19 | #include <Standard.hxx> |
20 | #include <Standard_DefineAlloc.hxx> |
21 | #include <Standard_Handle.hxx> |
22 | |
23 | #include <Standard_Real.hxx> |
24 | #include <GProp_GProps.hxx> |
25 | #include <Standard_Boolean.hxx> |
26 | #include <Standard_Address.hxx> |
27 | class BRepGProp_Face; |
28 | class gp_Pnt; |
29 | class BRepGProp_Domain; |
30 | class gp_Pln; |
31 | |
32 | |
33 | //! Computes the global properties of a geometric solid |
34 | //! (3D closed region of space) delimited with : |
35 | //! - a point and a surface |
36 | //! - a plane and a surface |
37 | //! |
38 | //! The surface can be : |
39 | //! - a surface limited with its parametric values U-V, |
40 | //! (naturally restricted) |
41 | //! - a surface limited in U-V space with its boundary |
42 | //! curves. |
43 | //! |
44 | //! The surface's requirements to evaluate the global |
45 | //! properties are defined in the template FaceTool class from |
46 | //! the package GProp. |
47 | //! |
48 | //! The adaptive 2D algorithm of Gauss-Kronrod integration of |
49 | //! double integral is used. |
50 | //! |
51 | //! The inner integral is computed along U parameter of |
52 | //! surface. The integrand function is encapsulated in the |
53 | //! support class UFunction that is defined below. |
54 | //! |
55 | //! The outer integral is computed along T parameter of a |
56 | //! bounding curve. The integrand function is encapsulated in |
57 | //! the support class TFunction that is defined below. |
58 | class BRepGProp_VinertGK : public GProp_GProps |
59 | { |
60 | public: |
61 | |
62 | DEFINE_STANDARD_ALLOC |
63 | |
64 | |
65 | //! Empty constructor. |
0f57ab75 |
66 | BRepGProp_VinertGK() |
67 | : myErrorReached (0.), myAbsolutError (0.) |
68 | { |
69 | } |
42cf5bc1 |
70 | |
71 | //! Constructor. Computes the global properties of a region of |
72 | //! 3D space delimited with the naturally restricted surface |
73 | //! and the point VLocation. |
74 | Standard_EXPORT BRepGProp_VinertGK(BRepGProp_Face& theSurface, const gp_Pnt& theLocation, const Standard_Real theTolerance = 0.001, const Standard_Boolean theCGFlag = Standard_False, const Standard_Boolean theIFlag = Standard_False); |
75 | |
76 | //! Constructor. Computes the global properties of a region of |
77 | //! 3D space delimited with the naturally restricted surface |
78 | //! and the point VLocation. The inertia is computed with |
79 | //! respect to thePoint. |
80 | Standard_EXPORT BRepGProp_VinertGK(BRepGProp_Face& theSurface, const gp_Pnt& thePoint, const gp_Pnt& theLocation, const Standard_Real theTolerance = 0.001, const Standard_Boolean theCGFlag = Standard_False, const Standard_Boolean theIFlag = Standard_False); |
81 | |
82 | //! Constructor. Computes the global properties of a region of |
83 | //! 3D space delimited with the surface bounded by the domain |
84 | //! and the point VLocation. |
85 | Standard_EXPORT BRepGProp_VinertGK(BRepGProp_Face& theSurface, BRepGProp_Domain& theDomain, const gp_Pnt& theLocation, const Standard_Real theTolerance = 0.001, const Standard_Boolean theCGFlag = Standard_False, const Standard_Boolean theIFlag = Standard_False); |
86 | |
87 | //! Constructor. Computes the global properties of a region of |
88 | //! 3D space delimited with the surface bounded by the domain |
89 | //! and the point VLocation. The inertia is computed with |
90 | //! respect to thePoint. |
91 | Standard_EXPORT BRepGProp_VinertGK(BRepGProp_Face& theSurface, BRepGProp_Domain& theDomain, const gp_Pnt& thePoint, const gp_Pnt& theLocation, const Standard_Real theTolerance = 0.001, const Standard_Boolean theCGFlag = Standard_False, const Standard_Boolean theIFlag = Standard_False); |
92 | |
93 | //! Constructor. Computes the global properties of a region of |
94 | //! 3D space delimited with the naturally restricted surface |
95 | //! and the plane. |
96 | Standard_EXPORT BRepGProp_VinertGK(BRepGProp_Face& theSurface, const gp_Pln& thePlane, const gp_Pnt& theLocation, const Standard_Real theTolerance = 0.001, const Standard_Boolean theCGFlag = Standard_False, const Standard_Boolean theIFlag = Standard_False); |
97 | |
98 | //! Constructor. Computes the global properties of a region of |
99 | //! 3D space delimited with the surface bounded by the domain |
100 | //! and the plane. |
101 | Standard_EXPORT BRepGProp_VinertGK(BRepGProp_Face& theSurface, BRepGProp_Domain& theDomain, const gp_Pln& thePlane, const gp_Pnt& theLocation, const Standard_Real theTolerance = 0.001, const Standard_Boolean theCGFlag = Standard_False, const Standard_Boolean theIFlag = Standard_False); |
102 | |
103 | //! Sets the vertex that delimit 3D closed region of space. |
0f57ab75 |
104 | void SetLocation (const gp_Pnt& theLocation) |
105 | { |
106 | loc = theLocation; |
107 | } |
42cf5bc1 |
108 | |
109 | //! Computes the global properties of a region of 3D space |
110 | //! delimited with the naturally restricted surface and the |
111 | //! point VLocation. |
112 | Standard_EXPORT Standard_Real Perform (BRepGProp_Face& theSurface, const Standard_Real theTolerance = 0.001, const Standard_Boolean theCGFlag = Standard_False, const Standard_Boolean theIFlag = Standard_False); |
113 | |
114 | //! Computes the global properties of a region of 3D space |
115 | //! delimited with the naturally restricted surface and the |
116 | //! point VLocation. The inertia is computed with respect to |
117 | //! thePoint. |
118 | Standard_EXPORT Standard_Real Perform (BRepGProp_Face& theSurface, const gp_Pnt& thePoint, const Standard_Real theTolerance = 0.001, const Standard_Boolean theCGFlag = Standard_False, const Standard_Boolean theIFlag = Standard_False); |
119 | |
120 | //! Computes the global properties of a region of 3D space |
121 | //! delimited with the surface bounded by the domain and the |
122 | //! point VLocation. |
123 | Standard_EXPORT Standard_Real Perform (BRepGProp_Face& theSurface, BRepGProp_Domain& theDomain, const Standard_Real theTolerance = 0.001, const Standard_Boolean theCGFlag = Standard_False, const Standard_Boolean theIFlag = Standard_False); |
124 | |
125 | //! Computes the global properties of a region of 3D space |
126 | //! delimited with the surface bounded by the domain and the |
127 | //! point VLocation. The inertia is computed with respect to |
128 | //! thePoint. |
129 | Standard_EXPORT Standard_Real Perform (BRepGProp_Face& theSurface, BRepGProp_Domain& theDomain, const gp_Pnt& thePoint, const Standard_Real theTolerance = 0.001, const Standard_Boolean theCGFlag = Standard_False, const Standard_Boolean theIFlag = Standard_False); |
130 | |
131 | //! Computes the global properties of a region of 3D space |
132 | //! delimited with the naturally restricted surface and the |
133 | //! plane. |
134 | Standard_EXPORT Standard_Real Perform (BRepGProp_Face& theSurface, const gp_Pln& thePlane, const Standard_Real theTolerance = 0.001, const Standard_Boolean theCGFlag = Standard_False, const Standard_Boolean theIFlag = Standard_False); |
135 | |
136 | //! Computes the global properties of a region of 3D space |
137 | //! delimited with the surface bounded by the domain and the |
138 | //! plane. |
139 | Standard_EXPORT Standard_Real Perform (BRepGProp_Face& theSurface, BRepGProp_Domain& theDomain, const gp_Pln& thePlane, const Standard_Real theTolerance = 0.001, const Standard_Boolean theCGFlag = Standard_False, const Standard_Boolean theIFlag = Standard_False); |
140 | |
141 | //! Returns the relative reached computation error. |
0f57ab75 |
142 | Standard_Real GetErrorReached () const |
143 | { |
144 | return myErrorReached; |
145 | } |
42cf5bc1 |
146 | |
147 | //! Returns the absolut reached computation error. |
148 | Standard_Real GetAbsolutError() const; |
149 | |
150 | |
151 | |
152 | |
153 | protected: |
154 | |
155 | |
156 | |
157 | |
158 | |
159 | private: |
160 | |
161 | |
162 | //! Main method for computation of the global properties that |
163 | //! is invoked by each Perform method. |
164 | Standard_EXPORT Standard_Real PrivatePerform (BRepGProp_Face& theSurface, const Standard_Address thePtrDomain, const Standard_Boolean IsByPoint, const Standard_Address theCoeffs, const Standard_Real theTolerance, const Standard_Boolean theCGFlag, const Standard_Boolean theIFlag); |
165 | |
166 | |
167 | Standard_Real myErrorReached; |
168 | Standard_Real myAbsolutError; |
42cf5bc1 |
169 | }; |
170 | |
171 | |
42cf5bc1 |
172 | #endif // _BRepGProp_VinertGK_HeaderFile |