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_UFunction_HeaderFile |
17 | #define _BRepGProp_UFunction_HeaderFile |
18 | |
19 | #include <Standard.hxx> |
20 | #include <Standard_DefineAlloc.hxx> |
21 | #include <Standard_Handle.hxx> |
22 | |
23 | #include <BRepGProp_Face.hxx> |
24 | #include <gp_Pnt.hxx> |
25 | #include <Standard_Address.hxx> |
26 | #include <Standard_Real.hxx> |
27 | #include <GProp_ValueType.hxx> |
28 | #include <Standard_Boolean.hxx> |
29 | #include <math_Function.hxx> |
30 | class BRepGProp_Face; |
31 | class gp_Pnt; |
32 | class gp_XYZ; |
33 | |
34 | |
35 | //! This class represents the integrand function for |
36 | //! computation of an inner integral. The returned value |
37 | //! depends on the value type and the flag IsByPoint. |
38 | //! |
39 | //! The type of returned value is the one of the following |
40 | //! values: |
41 | //! - GProp_Mass - volume computation. |
42 | //! - GProp_CenterMassX, GProp_CenterMassY, |
43 | //! GProp_CenterMassZ - X, Y and Z coordinates of center |
44 | //! of mass computation. |
45 | //! - GProp_InertiaXX, GProp_InertiaYY, GProp_InertiaZZ, |
46 | //! GProp_InertiaXY, GProp_InertiaXZ, GProp_InertiaYZ |
47 | //! - moments of inertia computation. |
48 | //! |
49 | //! If the flag IsByPoint is set to Standard_True, the value is |
50 | //! returned for the region of space that is delimited by a |
51 | //! surface and a point. Otherwise all computations are |
52 | //! performed for the region of space delimited by a surface |
53 | //! and a plane. |
54 | class BRepGProp_UFunction : public math_Function |
55 | { |
56 | public: |
57 | |
58 | DEFINE_STANDARD_ALLOC |
59 | |
60 | |
61 | //! Constructor. Initializes the function with the face, the |
62 | //! location point, the flag IsByPoint and the coefficients |
63 | //! theCoeff that have different meaning depending on the value |
64 | //! of IsByPoint. |
65 | //! If IsByPoint is equal to Standard_True, the number of the |
66 | //! coefficients is equal to 3 and they represent X, Y and Z |
67 | //! coordinates (theCoeff[0], theCoeff[1] and theCoeff[2] |
68 | //! correspondingly) of the shift, if the inertia is computed |
69 | //! with respect to the point different then the location. |
70 | //! If IsByPoint is equal to Standard_False, the number of the |
71 | //! coefficients is 4 and they represent the combination of |
72 | //! plane parameters and shift values. |
73 | Standard_EXPORT BRepGProp_UFunction(const BRepGProp_Face& theSurface, const gp_Pnt& theVertex, const Standard_Boolean IsByPoint, const Standard_Address theCoeffs); |
74 | |
75 | //! Setting the type of the value to be returned. |
76 | void SetValueType (const GProp_ValueType theType); |
77 | |
78 | //! Setting the V parameter that is constant during the |
79 | //! integral computation. |
80 | void SetVParam (const Standard_Real theVParam); |
81 | |
82 | //! Returns a value of the function. |
83 | Standard_EXPORT virtual Standard_Boolean Value (const Standard_Real X, Standard_Real& F) Standard_OVERRIDE; |
84 | |
85 | |
86 | |
87 | |
88 | protected: |
89 | |
90 | |
91 | |
92 | |
93 | |
94 | private: |
95 | |
96 | |
97 | //! Private method. Returns the value for volume computation. |
98 | //! Other returned values are: |
99 | //! - thePMP0 - PSurf(X,Y) minus Location. |
100 | //! - theS and theD1 coeffitients that are computed and used |
101 | //! for computation of center of mass and inertia values |
102 | //! by plane. |
103 | Standard_EXPORT Standard_Real VolumeValue (const Standard_Real X, gp_XYZ& thePMP0, Standard_Real& theS, Standard_Real& theD1); |
104 | |
105 | //! Private method. Returns a value for the center of mass |
106 | //! computation. If the value type other then GProp_CenterMassX, |
107 | //! GProp_CenterMassY or GProp_CenterMassZ this method returns |
108 | //! Standard_False. Returns Standard_True in case of successful |
109 | //! computation of a value. |
110 | Standard_EXPORT Standard_Boolean CenterMassValue (const Standard_Real X, Standard_Real& F); |
111 | |
112 | //! Private method. Computes the value of intertia. The type of |
113 | //! a value returned is defined by the value type. If it is |
114 | //! other then GProp_InertiaXX, GProp_InertiaYY, |
115 | //! GProp_InertiaZZ, GProp_InertiaXY, GProp_InertiaXZ or |
116 | //! GProp_InertiaYZ, the method returns Standard_False. Returns |
117 | //! Standard_True in case of successful computation of a value |
118 | Standard_EXPORT Standard_Boolean InertiaValue (const Standard_Real X, Standard_Real& F); |
119 | |
120 | |
121 | BRepGProp_Face mySurface; |
122 | gp_Pnt myVertex; |
123 | Standard_Address myCoeffs; |
124 | Standard_Real myVParam; |
125 | GProp_ValueType myValueType; |
126 | Standard_Boolean myIsByPoint; |
127 | |
128 | |
129 | }; |
130 | |
131 | |
132 | #include <BRepGProp_UFunction.lxx> |
133 | |
134 | |
135 | |
136 | |
137 | |
138 | #endif // _BRepGProp_UFunction_HeaderFile |