Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-09 09:15:37

0001 // Created on: 1992-02-17
0002 // Created by: Jean Claude VAUTHIER
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_PrincipalProps_HeaderFile
0018 #define _GProp_PrincipalProps_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <gp_Vec.hxx>
0025 #include <gp_Pnt.hxx>
0026 #include <GProp_GProps.hxx>
0027 #include <Standard_Boolean.hxx>
0028 
0029 //! A framework to present the principal properties of
0030 //! inertia of a system of which global properties are
0031 //! computed by a GProp_GProps object.
0032 //! There is always a set of axes for which the
0033 //! products of inertia of a geometric system are equal
0034 //! to 0; i.e. the matrix of inertia of the system is
0035 //! diagonal. These axes are the principal axes of
0036 //! inertia. Their origin is coincident with the center of
0037 //! mass of the system. The associated moments are
0038 //! called the principal moments of inertia.
0039 //! This sort of presentation object is created, filled and
0040 //! returned by the function PrincipalProperties for
0041 //! any GProp_GProps object, and can be queried to access the result.
0042 //! Note: The system whose principal properties of
0043 //! inertia are returned by this framework is referred to
0044 //! as the current system. The current system,
0045 //! however, is retained neither by this presentation
0046 //! framework nor by the GProp_GProps object which activates it.
0047 class GProp_PrincipalProps
0048 {
0049 public:
0050   DEFINE_STANDARD_ALLOC
0051 
0052   //! creates an undefined PrincipalProps.
0053   Standard_EXPORT GProp_PrincipalProps();
0054 
0055   //! returns true if the geometric system has an axis of symmetry.
0056   //! For  comparing  moments  relative  tolerance  1.e-10  is  used.
0057   //! Usually  it  is  enough  for  objects,  restricted  by  faces  with
0058   //! analytical  geometry.
0059   Standard_EXPORT Standard_Boolean HasSymmetryAxis() const;
0060 
0061   //! returns true if the geometric system has an axis of symmetry.
0062   //! aTol  is  relative  tolerance for  checking  equality  of  moments
0063   //! If  aTol  ==  0,  relative  tolerance  is  ~  1.e-16  (Epsilon(I))
0064   Standard_EXPORT Standard_Boolean HasSymmetryAxis(const Standard_Real aTol) const;
0065 
0066   //! returns true if the geometric system has a point of symmetry.
0067   //! For  comparing  moments  relative  tolerance  1.e-10  is  used.
0068   //! Usually  it  is  enough  for  objects,  restricted  by  faces  with
0069   //! analytical  geometry.
0070   Standard_EXPORT Standard_Boolean HasSymmetryPoint() const;
0071 
0072   //! returns true if the geometric system has a point of symmetry.
0073   //! aTol  is  relative  tolerance for  checking  equality  of  moments
0074   //! If  aTol  ==  0,  relative  tolerance  is  ~  1.e-16  (Epsilon(I))
0075   Standard_EXPORT Standard_Boolean HasSymmetryPoint(const Standard_Real aTol) const;
0076 
0077   //! Ixx, Iyy and Izz return the principal moments of inertia
0078   //! in the current system.
0079   //! Notes :
0080   //! - If the current system has an axis of symmetry, two
0081   //! of the three values Ixx, Iyy and Izz are equal. They
0082   //! indicate which eigen vectors define an infinity of
0083   //! axes of principal inertia.
0084   //! - If the current system has a center of symmetry, Ixx,
0085   //! Iyy and Izz are equal.
0086   Standard_EXPORT void Moments(Standard_Real& Ixx, Standard_Real& Iyy, Standard_Real& Izz) const;
0087 
0088   //! returns the first axis of inertia.
0089   //!
0090   //! if the system has a point of symmetry there is an infinity of
0091   //! solutions. It is not possible to defines the three axis of
0092   //! inertia.
0093   Standard_EXPORT const gp_Vec& FirstAxisOfInertia() const;
0094 
0095   //! returns the second axis of inertia.
0096   //!
0097   //! if the system has a point of symmetry or an axis of symmetry the
0098   //! second and the third axis of symmetry are undefined.
0099   Standard_EXPORT const gp_Vec& SecondAxisOfInertia() const;
0100 
0101   //! returns the third axis of inertia.
0102   //! This and the above functions return the first, second or third eigen vector of the
0103   //! matrix of inertia of the current system.
0104   //! The first, second and third principal axis of inertia
0105   //! pass through the center of mass of the current
0106   //! system. They are respectively parallel to these three eigen vectors.
0107   //! Note that:
0108   //! - If the current system has an axis of symmetry, any
0109   //! axis is an axis of principal inertia if it passes
0110   //! through the center of mass of the system, and runs
0111   //! parallel to a linear combination of the two eigen
0112   //! vectors of the matrix of inertia, corresponding to the
0113   //! two eigen values which are equal. If the current
0114   //! system has a center of symmetry, any axis passing
0115   //! through the center of mass of the system is an axis
0116   //! of principal inertia. Use the functions
0117   //! HasSymmetryAxis and HasSymmetryPoint to
0118   //! check these particular cases, where the returned
0119   //! eigen vectors define an infinity of principal axis of inertia.
0120   //! - The Moments function can be used to know which
0121   //! of the three eigen vectors corresponds to the two
0122   //! eigen values which are equal.
0123   //!
0124   //! if the system has a point of symmetry or an axis of symmetry the
0125   //! second and the third axis of symmetry are undefined.
0126   Standard_EXPORT const gp_Vec& ThirdAxisOfInertia() const;
0127 
0128   //! Returns the principal radii of gyration  Rxx, Ryy
0129   //! and Rzz are the radii of gyration of the current
0130   //! system about its three principal axes of inertia.
0131   //! Note that:
0132   //! - If the current system has an axis of symmetry,
0133   //! two of the three values Rxx, Ryy and Rzz are equal.
0134   //! - If the current system has a center of symmetry,
0135   //! Rxx, Ryy and Rzz are equal.
0136   Standard_EXPORT void RadiusOfGyration(Standard_Real& Rxx,
0137                                         Standard_Real& Ryy,
0138                                         Standard_Real& Rzz) const;
0139 
0140   friend
0141     //! Computes the principal properties of inertia of the current system.
0142     //! There is always a set of axes for which the products
0143     //! of inertia of a geometric system are equal to 0; i.e. the
0144     //! matrix of inertia of the system is diagonal. These axes
0145     //! are the principal axes of inertia. Their origin is
0146     //! coincident with the center of mass of the system. The
0147     //! associated moments are called the principal moments of inertia.
0148     //! This function computes the eigen values and the
0149     //! eigen vectors of the matrix of inertia of the system.
0150     //! Results are stored by using a presentation framework
0151     //! of principal properties of inertia
0152     //! (GProp_PrincipalProps object) which may be
0153     //! queried to access the value sought.
0154     Standard_EXPORT GProp_PrincipalProps
0155     GProp_GProps::PrincipalProperties() const;
0156 
0157 protected:
0158 private:
0159   Standard_EXPORT GProp_PrincipalProps(const Standard_Real Ixx,
0160                                        const Standard_Real Iyy,
0161                                        const Standard_Real Izz,
0162                                        const Standard_Real Rxx,
0163                                        const Standard_Real Ryy,
0164                                        const Standard_Real Rzz,
0165                                        const gp_Vec&       Vxx,
0166                                        const gp_Vec&       Vyy,
0167                                        const gp_Vec&       Vzz,
0168                                        const gp_Pnt&       G);
0169 
0170   Standard_Real i1;
0171   Standard_Real i2;
0172   Standard_Real i3;
0173   Standard_Real r1;
0174   Standard_Real r2;
0175   Standard_Real r3;
0176   gp_Vec        v1;
0177   gp_Vec        v2;
0178   gp_Vec        v3;
0179   gp_Pnt        g;
0180 };
0181 
0182 #endif // _GProp_PrincipalProps_HeaderFile