0024166: Unable to create file with "Save" menu of voxeldemo Qt sample
[occt.git] / src / GProp / GProp_GProps.cdl
CommitLineData
b311480e 1-- Created on: 1992-08-24
2-- Created by: Michel CHAUVAT
3-- Copyright (c) 1992-1999 Matra Datavision
4-- Copyright (c) 1999-2012 OPEN CASCADE SAS
5--
6-- The content of this file is subject to the Open CASCADE Technology Public
7-- License Version 6.5 (the "License"). You may not use the content of this file
8-- except in compliance with the License. Please obtain a copy of the License
9-- at http://www.opencascade.org and read it completely before using this file.
10--
11-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13--
14-- The Original Code and all software distributed under the License is
15-- distributed on an "AS IS" basis, without warranty of any kind, and the
16-- Initial Developer hereby disclaims all such warranties, including without
17-- limitation, any warranties of merchantability, fitness for a particular
18-- purpose or non-infringement. Please see the License for the specific terms
19-- and conditions governing the rights and limitations under the License.
20
7fd59977 21-- JCV January 1992
7fd59977 22
23
24class GProps from GProp
25
26 --- Purpose :
27 -- Implements a general mechanism to compute the global properties of
28 -- a "compound geometric system" in 3d space by composition of the
29 -- global properties of "elementary geometric entities" such as
30 -- (curve, surface, solid, set of points). It is possible to compose
31 -- the properties of several "compound geometric systems" too.
32 --
33 -- To computes the global properties of a compound geometric
34 -- system you should :
35 -- . declare the GProps using a constructor which initializes the
36 -- GProps and defines the location point used to compute the inertia
37 -- . compose the global properties of your geometric components with
38 -- the properties of your system using the method Add.
39 --
40 -- To compute the global properties of the geometric components of
41 -- the system you should use the services of the following classes :
42 -- - class PGProps for a set of points,
43 -- - class CGProps for a curve,
44 -- - class SGProps for a surface,
45 -- - class VGProps for a "solid".
46 -- The classes CGProps, SGProps, VGProps are generic classes and
47 -- must be instantiated for your application.
48 --
49 --
50 -- The global properties computed are :
51 -- - the dimension (length, area or volume)
52 -- - the mass,
53 -- - the centre of mass,
54 -- - the moments of inertia (static moments and quadratic moments),
55 -- - the moment about an axis,
56 -- - the radius of gyration about an axis,
57 -- - the principal properties of inertia :
58 -- (sea also class PrincipalProps)
59 -- . the principal moments,
60 -- . the principal axis of inertia,
61 -- . the principal radius of gyration,
62 --
63 --
64 --
65 -- Example of utilisation in a simplified C++ implementation :
66 --
67 -- //declares the GProps, the point (0.0, 0.0, 0.0) of the
68 -- //absolute cartesian coordinate system is used as
69 -- //default reference point to compute the centre of mass
70 -- GProp_GProps System ();
71 --
72 -- //computes the inertia of a 3d curve
73 -- Your_CGProps Component1 (curve, ....);
74 --
75 -- //computes the inertia of surfaces
76 -- Your_SGprops Component2 (surface1, ....);
77 -- Your_SGprops Component3 (surface2,....);
78 --
79 -- //composes the global properties of components 1, 2, 3
80 -- //a density can be associated with the components, the
81 -- //density can be defaulted to 1.
82 -- Real Density1 = 2.0;
83 -- Real Density2 = 3.0;
84 -- System.Add (Component1, Density1);
85 -- System.Add (Component2, Density2);
86 -- System.Add (Component3);
87 --
88 -- //returns the centre of mass of the system in the
89 -- //absolute cartesian coordinate system
90 -- gp_Pnt G = System.CentreOfMass ();
91 --
92 -- //computes the principales inertia of the system
93 -- GProp_PrincipalProps Pp = System.PrincipalProperties();
94 --
95 -- //returns the principal moments and radius of gyration
96 -- Real Ixx, Iyy, Izz, Rxx, Ryy, Rzz;
97 -- Pp.Moments (Ixx, Iyy, Izz);
98 -- Pp.RadiusOfGyration (Ixx, Iyy, Izz);
99 --
100 --
101
102uses Ax1 from gp,
103 Mat from gp,
104 Pnt from gp,
105 PrincipalProps from GProp
106
107raises DomainError from Standard
108
109is
110
111 Create returns GProps;
112 --- Purpose :
113 -- The origin (0, 0, 0) of the absolute cartesian coordinate system
114 -- is used to compute the global properties.
115
116
117 Create (SystemLocation : Pnt) returns GProps;
118 --- Purpose :
119 -- The point SystemLocation is used to compute the gobal properties
120 -- of the system. For more accuracy it is better to define this
121 -- point closed to the location of the system. For example it could
122 -- be a point around the centre of mass of the system.
123-- This point is referred to as the reference point for
124-- this framework. For greater accuracy it is better for
125-- the reference point to be close to the location of the
126-- system. It can, for example, be a point near the
127-- center of mass of the system.
128-- At initialization, the framework is empty; i.e. it
129-- retains no dimensional information such as mass, or
130-- inertia. However, it is now able to bring together
131-- global properties of various other systems, whose
132-- global properties have already been computed
133-- using another framework. To do this, use the
134-- function Add to define the components of the
135-- system. Use it once per component of the system,
136-- and then use the interrogation functions available to
137-- access the computed values.
138
139
140 Add (me : in out; Item : GProps; Density : Real =1.0)
141 --- Purpose : Either
142-- - initializes the global properties retained by this
143-- framework from those retained by the framework Item, or
144-- - brings together the global properties still retained by
145-- this framework with those retained by the framework Item.
146-- The value Density, which is 1.0 by default, is used as
147-- the density of the system analysed by Item.
148-- Sometimes the density will have already been given at
149-- the time of construction of the framework Item. This
150-- may be the case for example, if Item is a
151-- GProp_PGProps framework built to compute the
152-- global properties of a set of points ; or another
153-- GProp_GProps object which already retains
154-- composite global properties. In these cases the real
155-- density was perhaps already taken into account at the
156-- time of construction of Item. Note that this is not
157-- checked: if the density of parts of the system is taken
158-- into account two or more times, results of the
159-- computation will be false.
160-- Notes :
161-- - The point relative to which the inertia of Item is
162-- computed (i.e. the reference point of Item) may be
163-- different from the reference point in this
164-- framework. Huygens' theorem is applied
165-- automatically to transfer inertia values to the
166 -- reference point in this framework.
167-- - The function Add is used once per component of
168-- the system. After that, you use the interrogation
169-- functions available to access values computed for the system.
170-- - The system whose global properties are already
171-- brought together by this framework is referred to
172-- as the current system. However, the current system
173-- is not retained by this framework, which maintains
174-- only its global properties.
175-- Exceptions
176-- Standard_DomainError if Density is less than or
177-- equal to gp::Resolution().
178 raises DomainError
179 is static;
180
181
182
183 Mass (me) returns Real is static;
184 --- Purpose: Returns the mass of the current system.
185-- If no density is attached to the components of the
186-- current system the returned value corresponds to :
187-- - the total length of the edges of the current
188-- system if this framework retains only linear
189-- properties, as is the case for example, when
190-- using only the LinearProperties function to
191-- combine properties of lines from shapes, or
192-- - the total area of the faces of the current system if
193-- this framework retains only surface properties,
194-- as is the case for example, when using only the
195-- SurfaceProperties function to combine
196-- properties of surfaces from shapes, or
197-- - the total volume of the solids of the current
198-- system if this framework retains only volume
199-- properties, as is the case for example, when
200-- using only the VolumeProperties function to
201-- combine properties of volumes from solids.
202-- Warning
203-- A length, an area, or a volume is computed in the
204-- current data unit system. The mass of a single
205-- object is obtained by multiplying its length, its area
206-- or its volume by the given density. You must be
207-- consistent with respect to the units used.
208
209
210 CentreOfMass (me) returns Pnt is static;
211 --- Purpose :
212 -- Returns the center of mass of the current system. If
213-- the gravitational field is uniform, it is the center of gravity.
214-- The coordinates returned for the center of mass are
215-- expressed in the absolute Cartesian coordinate system.
216
217 MatrixOfInertia (me) returns Mat is static;
218 --- Purpose:
219 -- returns the matrix of inertia. It is a symmetrical matrix.
220 -- The coefficients of the matrix are the quadratic moments of
221 -- inertia.
222 --
223 -- | Ixx Ixy Ixz |
224 -- matrix = | Ixy Iyy Iyz |
225 -- | Ixz Iyz Izz |
226 --
227 -- The moments of inertia are denoted by Ixx, Iyy, Izz.
228 -- The products of inertia are denoted by Ixy, Ixz, Iyz.
229 -- The matrix of inertia is returned in the central coordinate
230 -- system (G, Gx, Gy, Gz) where G is the centre of mass of the
231 -- system and Gx, Gy, Gz the directions parallel to the X(1,0,0)
232 -- Y(0,1,0) Z(0,0,1) directions of the absolute cartesian
233 -- coordinate system. It is possible to compute the matrix of
234 -- inertia at another location point using the Huyghens theorem
235 -- (you can use the method of package GProp : HOperator).
236
237
238 StaticMoments (me; Ix, Iy, Iz : out Real) is static;
239 --- Purpose : Returns Ix, Iy, Iz, the static moments of inertia of the
240-- current system; i.e. the moments of inertia about the
241-- three axes of the Cartesian coordinate system.
242
243
244
245 MomentOfInertia (me; A : Ax1) returns Real is static;
246 --- Purpose :
247 -- computes the moment of inertia of the material system about the
248 -- axis A.
249
250
251 PrincipalProperties (me) returns PrincipalProps is static;
252 --- Purpose : Computes the principal properties of inertia of the current system.
253-- There is always a set of axes for which the products
254-- of inertia of a geometric system are equal to 0; i.e. the
255-- matrix of inertia of the system is diagonal. These axes
256-- are the principal axes of inertia. Their origin is
257-- coincident with the center of mass of the system. The
258-- associated moments are called the principal moments of inertia.
259-- This function computes the eigen values and the
260-- eigen vectors of the matrix of inertia of the system.
261-- Results are stored by using a presentation framework
262-- of principal properties of inertia
263-- (GProp_PrincipalProps object) which may be
264-- queried to access the value sought.
265
266
267
268 RadiusOfGyration (me; A : Ax1) returns Real is static;
269 --- Purpose : Returns the radius of gyration of the current system about the axis A.
270
271
272
273
274fields
275
276 g : Pnt is protected;
277 --- Purpose : centre of mass
278 loc : Pnt is protected;
279 --- Purpose : location point used to compute the inertia
280 dim : Real is protected;
281 --- Purpose : mass or length or area or volume of the GProps
282 inertia : Mat is protected;
283 --- Purpose : matrix of inertia
284
285end GProps;
286
287