Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-13 09:15:51

0001 // Copyright (c) 2018 OPEN CASCADE SAS
0002 //
0003 // This file is part of Open CASCADE Technology software library.
0004 //
0005 // This library is free software; you can redistribute it and/or modify it under
0006 // the terms of the GNU Lesser General Public License version 2.1 as published
0007 // by the Free Software Foundation, with special exception defined in the file
0008 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0009 // distribution for complete text of the license and disclaimer of any warranty.
0010 //
0011 // Alternatively, this file may be used under the terms of Open CASCADE
0012 // commercial license or contractual agreement.
0013 
0014 #ifndef _BRepGProp_MeshProps_HeaderFile
0015 #define _BRepGProp_MeshProps_HeaderFile
0016 
0017 #include <GProp_GProps.hxx>
0018 #include <TopAbs_Orientation.hxx>
0019 #include <gp_Pnt.hxx>
0020 #include <NCollection_Array1.hxx>
0021 
0022 class Poly_Triangulation;
0023 class TopLoc_Location;
0024 
0025 //! Computes the global properties of a surface mesh. The mesh can be
0026 //! interpreted as just a surface or as a piece of volume limited by this surface.
0027 class BRepGProp_MeshProps : public GProp_GProps
0028 {
0029 public:
0030   DEFINE_STANDARD_ALLOC
0031 
0032   //! Describes types of geometric objects.
0033   //! - Vinert is 3D closed region of space delimited with
0034   //!   Point and surface mesh;
0035   //! - Sinert is surface mesh in 3D space.
0036   typedef enum
0037   {
0038     Vinert = 0,
0039     Sinert
0040   } BRepGProp_MeshObjType;
0041 
0042   //! Constructor takes the type of object.
0043   BRepGProp_MeshProps(const BRepGProp_MeshObjType theType)
0044       : myType(theType)
0045   {
0046   }
0047 
0048   //! Sets the point relative which the calculation is to be done
0049   void SetLocation(const gp_Pnt& theLocation) { loc = theLocation; }
0050 
0051   //! Computes the global properties of a surface mesh of 3D space.
0052   //! Calculation of surface properties is performed by numerical integration
0053   //! over triangle surfaces using Gauss cubature formulas.
0054   //! Depending on the mesh object type used in constructor this method can
0055   //! calculate the surface or volume properties of the mesh.
0056   Standard_EXPORT void Perform(const occ::handle<Poly_Triangulation>& theMesh,
0057                                const TopLoc_Location&                 theLoc,
0058                                const TopAbs_Orientation               theOri);
0059 
0060   Standard_EXPORT void Perform(const occ::handle<Poly_Triangulation>& theMesh,
0061                                const TopAbs_Orientation               theOri);
0062 
0063   //! Computes the global properties of triangle {p1, p2, p3} relatively
0064   //! point Apex
0065   //! If isVolume = true, volume properties are calculated
0066   //! otherwise - surface ones
0067   Standard_EXPORT static void CalculateProps(const gp_Pnt& p1,
0068                                              const gp_Pnt& p2,
0069                                              const gp_Pnt& p3,
0070                                              const gp_Pnt& Apex,
0071                                              const bool    isVolume,
0072                                              double        GProps[10],
0073                                              const int     NbGaussPoints,
0074                                              const double* GaussPnts);
0075 
0076   //! Get type of mesh object
0077   BRepGProp_MeshObjType GetMeshObjType() const { return myType; }
0078 
0079 private:                        //! @name private fields
0080   BRepGProp_MeshObjType myType; //!< Type of geometric object
0081 };
0082 
0083 #endif // _BRepGProp_MeshProps_HeaderFile