Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:12

0001 // Created on: 1992-12-04
0002 // Created by: Isabelle GRIGNON
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 _BRepGProp_HeaderFile
0018 #define _BRepGProp_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <Standard_Boolean.hxx>
0025 #include <TColgp_Array1OfXYZ.hxx>
0026 
0027 class TopoDS_Shape;
0028 class GProp_GProps;
0029 class gp_Pln;
0030 
0031 
0032 //! Provides global functions to compute a shape's global
0033 //! properties for lines, surfaces or volumes, and bring
0034 //! them together with the global properties already
0035 //! computed for a geometric system.
0036 //! The global properties computed for a system are :
0037 //! - its mass,
0038 //! - its center of mass,
0039 //! - its matrix of inertia,
0040 //! - its moment about an axis,
0041 //! - its radius of gyration about an axis,
0042 //! - and its principal properties of inertia such as
0043 //! principal axis, principal moments, principal radius of gyration.
0044 class BRepGProp 
0045 {
0046 public:
0047 
0048   DEFINE_STANDARD_ALLOC
0049 
0050   
0051   //! Computes the linear global properties of the shape S,
0052   //! i.e. the global properties induced by each edge of the
0053   //! shape S, and brings them together with the global
0054   //! properties still retained by the framework LProps. If
0055   //! the current system of LProps was empty, its global
0056   //! properties become equal to the linear global
0057   //! properties of S.
0058   //! For this computation no linear density is attached to
0059   //! the edges. So, for example, the added mass
0060   //! corresponds to the sum of the lengths of the edges of
0061   //! S. The density of the composed systems, i.e. that of
0062   //! each component of the current system of LProps, and
0063   //! that of S which is considered to be equal to 1, must be coherent.
0064   //! Note that this coherence cannot be checked. You are
0065   //! advised to use a separate framework for each
0066   //! density, and then to bring these frameworks together
0067   //! into a global one.
0068   //! The point relative to which the inertia of the system is
0069   //! computed is the reference point of the framework LProps.
0070   //! Note: if your programming ensures that the framework
0071   //! LProps retains only linear global properties (brought
0072   //! together for example, by the function
0073   //! LinearProperties) for objects the density of which is
0074   //! equal to 1 (or is not defined), the function Mass will
0075   //! return the total length of edges of the system analysed by LProps.
0076   //! Warning
0077   //! No check is performed to verify that the shape S
0078   //! retains truly linear properties. If S is simply a vertex, it
0079   //! is not considered to present any additional global properties.
0080   //! SkipShared is a special flag, which allows taking in calculation 
0081   //! shared topological entities or not.
0082   //! For ex., if SkipShared = True, edges, shared by two or more faces, 
0083   //! are taken into calculation only once.
0084   //! If we have cube with sizes 1, 1, 1, its linear properties = 12 
0085   //! for SkipEdges = true and 24 for SkipEdges = false.
0086   //! UseTriangulation is a special flag, which defines preferable 
0087   //! source of geometry data. If UseTriangulation = Standard_False,
0088   //! exact geometry objects (curves) are used, otherwise polygons of 
0089   //! triangulation are used first.
0090   Standard_EXPORT static void LinearProperties(const TopoDS_Shape& S, GProp_GProps& LProps, 
0091                                   const Standard_Boolean SkipShared = Standard_False,
0092                                   const Standard_Boolean UseTriangulation = Standard_False);
0093   
0094   //! Computes the surface global properties of the
0095   //! shape S, i.e. the global properties induced by each
0096   //! face of the shape S, and brings them together with
0097   //! the global properties still retained by the framework
0098   //! SProps. If the current system of SProps was empty,
0099   //! its global properties become equal to the surface
0100   //! global properties of S.
0101   //! For this computation, no surface density is attached
0102   //! to the faces. Consequently, the added mass
0103   //! corresponds to the sum of the areas of the faces of
0104   //! S. The density of the component systems, i.e. that
0105   //! of each component of the current system of
0106   //! SProps, and that of S which is considered to be
0107   //! equal to 1, must be coherent.
0108   //! Note that this coherence cannot be checked. You
0109   //! are advised to use a framework for each different
0110   //! value of density, and then to bring these
0111   //! frameworks together into a global one.
0112   //! The point relative to which the inertia of the system
0113   //! is computed is the reference point of the framework SProps.
0114   //! Note : if your programming ensures that the
0115   //! framework SProps retains only surface global
0116   //! properties, brought together, for example, by the
0117   //! function SurfaceProperties, for objects the density
0118   //! of which is equal to 1 (or is not defined), the
0119   //! function Mass will return the total area of faces of
0120   //! the system analysed by SProps.
0121   //! Warning
0122   //! No check is performed to verify that the shape S
0123   //! retains truly surface properties. If S is simply a
0124   //! vertex, an edge or a wire, it is not considered to
0125   //! present any additional global properties.
0126   //! SkipShared is a special flag, which allows taking in calculation 
0127   //! shared topological entities or not.
0128   //! For ex., if SkipShared = True, faces, shared by two or more shells, 
0129   //! are taken into calculation only once.
0130   //! UseTriangulation is a special flag, which defines preferable 
0131   //! source of geometry data. If UseTriangulation = Standard_False,
0132   //! exact geometry objects (surfaces) are used, 
0133   //! otherwise face triangulations are used first.
0134   Standard_EXPORT static void SurfaceProperties(const TopoDS_Shape& S, GProp_GProps& SProps, 
0135                                          const Standard_Boolean SkipShared = Standard_False,
0136                                   const Standard_Boolean UseTriangulation = Standard_False);
0137   
0138   //! Updates <SProps> with the shape <S>, that contains its principal properties.
0139   //! The surface properties of all the faces in <S> are computed.
0140   //! Adaptive 2D Gauss integration is used.
0141   //! Parameter Eps sets maximal relative error of computed mass (area) for each face.
0142   //! Error is calculated as Abs((M(i+1)-M(i))/M(i+1)), M(i+1) and M(i) are values
0143   //! for two successive steps of adaptive integration.
0144   //! Method returns estimation of relative error reached for whole shape.
0145   //! WARNING: if Eps > 0.001 algorithm performs non-adaptive integration.
0146   //! SkipShared is a special flag, which allows taking in calculation 
0147   //! shared topological entities or not
0148   //! For ex., if SkipShared = True, faces, shared by two or more shells, 
0149   //! are taken into calculation only once.
0150   Standard_EXPORT static Standard_Real SurfaceProperties (const TopoDS_Shape& S, GProp_GProps& SProps,
0151                         const Standard_Real Eps, const Standard_Boolean SkipShared = Standard_False);
0152   //!
0153   //! Computes the global volume properties of the solid
0154   //! S, and brings them together with the global
0155   //! properties still retained by the framework VProps. If
0156   //! the current system of VProps was empty, its global
0157   //! properties become equal to the global properties of S for volume.
0158   //! For this computation, no volume density is attached
0159   //! to the solid. Consequently, the added mass
0160   //! corresponds to the volume of S. The density of the
0161   //! component systems, i.e. that of each component of
0162   //! the current system of VProps, and that of S which
0163   //! is considered to be equal to 1, must be coherent to each other.
0164   //! Note that this coherence cannot be checked. You
0165   //! are advised to use a separate framework for each
0166   //! density, and then to bring these frameworks
0167   //! together into a global one.
0168   //! The point relative to which the inertia of the system
0169   //! is computed is the reference point of the framework VProps.
0170   //! Note: if your programming ensures that the
0171   //! framework VProps retains only global properties of
0172   //! volume (brought together for example, by the
0173   //! function VolumeProperties) for objects the density
0174   //! of which is equal to 1 (or is not defined), the
0175   //! function Mass will return the total volume of the
0176   //! solids of the system analysed by VProps.
0177   //! Warning
0178   //! The shape S must represent an object whose
0179   //! global volume properties can be computed. It may
0180   //! be a finite solid, or a series of finite solids all
0181   //! oriented in a coherent way. Nonetheless, S must be
0182   //! exempt of any free boundary. Note that these
0183   //! conditions of coherence are not checked by this
0184   //! algorithm, and results will be false if they are not respected. 
0185   //! SkipShared a is special flag, which allows taking in calculation 
0186   //! shared topological entities or not.
0187   //! For ex., if SkipShared = True, the volumes formed by the equal 
0188   //! (the same TShape, location and orientation) faces are taken 
0189   //! into calculation only once.
0190   //! UseTriangulation is a special flag, which defines preferable
0191   //! source of geometry data. If UseTriangulation = Standard_False,
0192   //! exact geometry objects (surfaces) are used, 
0193   //! otherwise face triangulations are used first.
0194   Standard_EXPORT static void VolumeProperties(const TopoDS_Shape& S, GProp_GProps& VProps, 
0195                                         const Standard_Boolean OnlyClosed = Standard_False, 
0196                                         const Standard_Boolean SkipShared = Standard_False,
0197                                  const Standard_Boolean UseTriangulation = Standard_False);
0198   
0199   //! Updates <VProps> with the shape <S>, that contains its principal properties.
0200   //! The volume properties of all the FORWARD and REVERSED faces in <S> are computed.
0201   //! If OnlyClosed is True then computed faces must belong to closed Shells.
0202   //! Adaptive 2D Gauss integration is used.
0203   //! Parameter Eps sets maximal relative error of computed mass (volume) for each face.
0204   //! Error is calculated as Abs((M(i+1)-M(i))/M(i+1)), M(i+1) and M(i) are values
0205   //! for two successive steps of adaptive integration.
0206   //! Method returns estimation of relative error reached for whole shape.
0207   //! WARNING: if Eps > 0.001 algorithm performs non-adaptive integration.
0208   //! SkipShared is a special flag, which allows taking in calculation shared
0209   //! topological entities or not.
0210   //! For ex., if SkipShared = True, the volumes formed by the equal 
0211   //! (the same TShape, location and orientation) 
0212   //! faces are taken into calculation only once.
0213   Standard_EXPORT static Standard_Real VolumeProperties (const TopoDS_Shape& S, GProp_GProps& VProps, 
0214                          const Standard_Real Eps, const Standard_Boolean OnlyClosed = Standard_False, 
0215                                                  const Standard_Boolean SkipShared = Standard_False);
0216   
0217   //! Updates <VProps> with the shape <S>, that contains its principal properties.
0218   //! The volume properties of all the FORWARD and REVERSED faces in <S> are computed.
0219   //! If OnlyClosed is True then computed faces must belong to closed Shells.
0220   //! Adaptive 2D Gauss integration is used.
0221   //! Parameter IsUseSpan says if it is necessary to define spans on a face.
0222   //! This option has an effect only for BSpline faces.
0223   //! Parameter Eps sets maximal relative error of computed property for each face.
0224   //! Error is delivered by the adaptive Gauss-Kronrod method of integral computation
0225   //! that is used for properties computation.
0226   //! Method returns estimation of relative error reached for whole shape.
0227   //! Returns negative value if the computation is failed.
0228   //! SkipShared is a special flag, which allows taking in calculation
0229   //! shared topological entities or not.
0230   //! For ex., if SkipShared = True, the volumes formed by the equal 
0231   //! (the same TShape, location and orientation) faces are taken into calculation only once.
0232   Standard_EXPORT static Standard_Real VolumePropertiesGK (const TopoDS_Shape& S, 
0233     GProp_GProps& VProps, 
0234     const Standard_Real Eps = 0.001, 
0235     const Standard_Boolean OnlyClosed = Standard_False, 
0236     const Standard_Boolean IsUseSpan = Standard_False, 
0237     const Standard_Boolean CGFlag = Standard_False, 
0238     const Standard_Boolean IFlag = Standard_False, 
0239     const Standard_Boolean SkipShared = Standard_False);
0240   
0241   Standard_EXPORT static Standard_Real VolumePropertiesGK (const TopoDS_Shape& S, 
0242     GProp_GProps& VProps, 
0243     const gp_Pln& thePln, const Standard_Real Eps = 0.001, 
0244     const Standard_Boolean OnlyClosed = Standard_False, 
0245     const Standard_Boolean IsUseSpan = Standard_False, 
0246     const Standard_Boolean CGFlag = Standard_False, 
0247     const Standard_Boolean IFlag = Standard_False, 
0248     const Standard_Boolean SkipShared = Standard_False);
0249 
0250 };
0251 
0252 #endif // _BRepGProp_HeaderFile