|
||||
File indexing completed on 2025-01-18 10:03:46
0001 // Created on: 1992-08-24 0002 // Created by: Michel CHAUVAT 0003 // Copyright (c) 1992-1999 Matra Datavision 0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS 0005 // 0006 // This file is part of Open CASCADE Technology software library. 0007 // 0008 // This library is free software; you can redistribute it and/or modify it under 0009 // the terms of the GNU Lesser General Public License version 2.1 as published 0010 // by the Free Software Foundation, with special exception defined in the file 0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT 0012 // distribution for complete text of the license and disclaimer of any warranty. 0013 // 0014 // Alternatively, this file may be used under the terms of Open CASCADE 0015 // commercial license or contractual agreement. 0016 0017 #ifndef _GProp_GProps_HeaderFile 0018 #define _GProp_GProps_HeaderFile 0019 0020 #include <Standard.hxx> 0021 #include <Standard_DefineAlloc.hxx> 0022 0023 #include <gp_Pnt.hxx> 0024 #include <gp_Mat.hxx> 0025 class gp_Ax1; 0026 class GProp_PrincipalProps; 0027 0028 0029 0030 //! Implements a general mechanism to compute the global properties of 0031 //! a "compound geometric system" in 3d space by composition of the 0032 //! global properties of "elementary geometric entities" such as 0033 //! (curve, surface, solid, set of points). It is possible to compose 0034 //! the properties of several "compound geometric systems" too. 0035 //! 0036 //! To computes the global properties of a compound geometric 0037 //! system you should : 0038 //! . declare the GProps using a constructor which initializes the 0039 //! GProps and defines the location point used to compute the inertia 0040 //! . compose the global properties of your geometric components with 0041 //! the properties of your system using the method Add. 0042 //! 0043 //! To compute the global properties of the geometric components of 0044 //! the system you should use the services of the following classes : 0045 //! - class PGProps for a set of points, 0046 //! - class CGProps for a curve, 0047 //! - class SGProps for a surface, 0048 //! - class VGProps for a "solid". 0049 //! The classes CGProps, SGProps, VGProps are generic classes and 0050 //! must be instantiated for your application. 0051 //! 0052 //! The global properties computed are : 0053 //! - the dimension (length, area or volume) 0054 //! - the mass, 0055 //! - the centre of mass, 0056 //! - the moments of inertia (static moments and quadratic moments), 0057 //! - the moment about an axis, 0058 //! - the radius of gyration about an axis, 0059 //! - the principal properties of inertia : 0060 //! (sea also class PrincipalProps) 0061 //! . the principal moments, 0062 //! . the principal axis of inertia, 0063 //! . the principal radius of gyration, 0064 //! 0065 //! Example of utilisation in a simplified C++ implementation : 0066 //! 0067 //! //declares the GProps, the point (0.0, 0.0, 0.0) of the 0068 //! //absolute cartesian coordinate system is used as 0069 //! //default reference point to compute the centre of mass 0070 //! GProp_GProps System (); 0071 //! 0072 //! //computes the inertia of a 3d curve 0073 //! Your_CGProps Component1 (curve, ....); 0074 //! 0075 //! //computes the inertia of surfaces 0076 //! Your_SGprops Component2 (surface1, ....); 0077 //! Your_SGprops Component3 (surface2,....); 0078 //! 0079 //! //composes the global properties of components 1, 2, 3 0080 //! //a density can be associated with the components, the 0081 //! //density can be defaulted to 1. 0082 //! Real Density1 = 2.0; 0083 //! Real Density2 = 3.0; 0084 //! System.Add (Component1, Density1); 0085 //! System.Add (Component2, Density2); 0086 //! System.Add (Component3); 0087 //! 0088 //! //returns the centre of mass of the system in the 0089 //! //absolute cartesian coordinate system 0090 //! gp_Pnt G = System.CentreOfMass (); 0091 //! 0092 //! //computes the principales inertia of the system 0093 //! GProp_PrincipalProps Pp = System.PrincipalProperties(); 0094 //! 0095 //! //returns the principal moments and radius of gyration 0096 //! Real Ixx, Iyy, Izz, Rxx, Ryy, Rzz; 0097 //! Pp.Moments (Ixx, Iyy, Izz); 0098 //! Pp.RadiusOfGyration (Ixx, Iyy, Izz); 0099 class GProp_GProps 0100 { 0101 public: 0102 0103 DEFINE_STANDARD_ALLOC 0104 0105 0106 0107 //! The origin (0, 0, 0) of the absolute cartesian coordinate system 0108 //! is used to compute the global properties. 0109 Standard_EXPORT GProp_GProps(); 0110 0111 0112 //! The point SystemLocation is used to compute the global properties 0113 //! of the system. For more accuracy it is better to define this 0114 //! point closed to the location of the system. For example it could 0115 //! be a point around the centre of mass of the system. 0116 //! This point is referred to as the reference point for 0117 //! this framework. For greater accuracy it is better for 0118 //! the reference point to be close to the location of the 0119 //! system. It can, for example, be a point near the 0120 //! center of mass of the system. 0121 //! At initialization, the framework is empty; i.e. it 0122 //! retains no dimensional information such as mass, or 0123 //! inertia. However, it is now able to bring together 0124 //! global properties of various other systems, whose 0125 //! global properties have already been computed 0126 //! using another framework. To do this, use the 0127 //! function Add to define the components of the 0128 //! system. Use it once per component of the system, 0129 //! and then use the interrogation functions available to 0130 //! access the computed values. 0131 Standard_EXPORT GProp_GProps(const gp_Pnt& SystemLocation); 0132 0133 //! Either 0134 //! - initializes the global properties retained by this 0135 //! framework from those retained by the framework Item, or 0136 //! - brings together the global properties still retained by 0137 //! this framework with those retained by the framework Item. 0138 //! The value Density, which is 1.0 by default, is used as 0139 //! the density of the system analysed by Item. 0140 //! Sometimes the density will have already been given at 0141 //! the time of construction of the framework Item. This 0142 //! may be the case for example, if Item is a 0143 //! GProp_PGProps framework built to compute the 0144 //! global properties of a set of points ; or another 0145 //! GProp_GProps object which already retains 0146 //! composite global properties. In these cases the real 0147 //! density was perhaps already taken into account at the 0148 //! time of construction of Item. Note that this is not 0149 //! checked: if the density of parts of the system is taken 0150 //! into account two or more times, results of the 0151 //! computation will be false. 0152 //! Notes : 0153 //! - The point relative to which the inertia of Item is 0154 //! computed (i.e. the reference point of Item) may be 0155 //! different from the reference point in this 0156 //! framework. Huygens' theorem is applied 0157 //! automatically to transfer inertia values to the 0158 //! reference point in this framework. 0159 //! - The function Add is used once per component of 0160 //! the system. After that, you use the interrogation 0161 //! functions available to access values computed for the system. 0162 //! - The system whose global properties are already 0163 //! brought together by this framework is referred to 0164 //! as the current system. However, the current system 0165 //! is not retained by this framework, which maintains 0166 //! only its global properties. 0167 //! Exceptions 0168 //! Standard_DomainError if Density is less than or 0169 //! equal to gp::Resolution(). 0170 Standard_EXPORT void Add (const GProp_GProps& Item, const Standard_Real Density = 1.0); 0171 0172 //! Returns the mass of the current system. 0173 //! If no density is attached to the components of the 0174 //! current system the returned value corresponds to : 0175 //! - the total length of the edges of the current 0176 //! system if this framework retains only linear 0177 //! properties, as is the case for example, when 0178 //! using only the LinearProperties function to 0179 //! combine properties of lines from shapes, or 0180 //! - the total area of the faces of the current system if 0181 //! this framework retains only surface properties, 0182 //! as is the case for example, when using only the 0183 //! SurfaceProperties function to combine 0184 //! properties of surfaces from shapes, or 0185 //! - the total volume of the solids of the current 0186 //! system if this framework retains only volume 0187 //! properties, as is the case for example, when 0188 //! using only the VolumeProperties function to 0189 //! combine properties of volumes from solids. 0190 //! Warning 0191 //! A length, an area, or a volume is computed in the 0192 //! current data unit system. The mass of a single 0193 //! object is obtained by multiplying its length, its area 0194 //! or its volume by the given density. You must be 0195 //! consistent with respect to the units used. 0196 Standard_EXPORT Standard_Real Mass() const; 0197 0198 0199 //! Returns the center of mass of the current system. If 0200 //! the gravitational field is uniform, it is the center of gravity. 0201 //! The coordinates returned for the center of mass are 0202 //! expressed in the absolute Cartesian coordinate system. 0203 Standard_EXPORT gp_Pnt CentreOfMass() const; 0204 0205 0206 //! returns the matrix of inertia. It is a symmetrical matrix. 0207 //! The coefficients of the matrix are the quadratic moments of 0208 //! inertia. 0209 //! 0210 //! | Ixx Ixy Ixz | 0211 //! matrix = | Ixy Iyy Iyz | 0212 //! | Ixz Iyz Izz | 0213 //! 0214 //! The moments of inertia are denoted by Ixx, Iyy, Izz. 0215 //! The products of inertia are denoted by Ixy, Ixz, Iyz. 0216 //! The matrix of inertia is returned in the central coordinate 0217 //! system (G, Gx, Gy, Gz) where G is the centre of mass of the 0218 //! system and Gx, Gy, Gz the directions parallel to the X(1,0,0) 0219 //! Y(0,1,0) Z(0,0,1) directions of the absolute cartesian 0220 //! coordinate system. It is possible to compute the matrix of 0221 //! inertia at another location point using the Huyghens theorem 0222 //! (you can use the method of package GProp : HOperator). 0223 Standard_EXPORT gp_Mat MatrixOfInertia() const; 0224 0225 //! Returns Ix, Iy, Iz, the static moments of inertia of the 0226 //! current system; i.e. the moments of inertia about the 0227 //! three axes of the Cartesian coordinate system. 0228 Standard_EXPORT void StaticMoments (Standard_Real& Ix, Standard_Real& Iy, Standard_Real& Iz) const; 0229 0230 0231 //! computes the moment of inertia of the material system about the 0232 //! axis A. 0233 Standard_EXPORT Standard_Real MomentOfInertia (const gp_Ax1& A) const; 0234 0235 //! Computes the principal properties of inertia of the current system. 0236 //! There is always a set of axes for which the products 0237 //! of inertia of a geometric system are equal to 0; i.e. the 0238 //! matrix of inertia of the system is diagonal. These axes 0239 //! are the principal axes of inertia. Their origin is 0240 //! coincident with the center of mass of the system. The 0241 //! associated moments are called the principal moments of inertia. 0242 //! This function computes the eigen values and the 0243 //! eigen vectors of the matrix of inertia of the system. 0244 //! Results are stored by using a presentation framework 0245 //! of principal properties of inertia 0246 //! (GProp_PrincipalProps object) which may be 0247 //! queried to access the value sought. 0248 Standard_EXPORT GProp_PrincipalProps PrincipalProperties() const; 0249 0250 //! Returns the radius of gyration of the current system about the axis A. 0251 Standard_EXPORT Standard_Real RadiusOfGyration (const gp_Ax1& A) const; 0252 0253 0254 0255 0256 protected: 0257 0258 0259 0260 gp_Pnt g; 0261 gp_Pnt loc; 0262 Standard_Real dim; 0263 gp_Mat inertia; 0264 0265 0266 private: 0267 0268 0269 0270 0271 0272 }; 0273 0274 0275 0276 0277 0278 0279 0280 #endif // _GProp_GProps_HeaderFile
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |