Back to home page

EIC code displayed by LXR

 
 

    


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

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 <TColgp_Array1OfPnt.hxx>
0020 
0021 class Poly_Triangulation;
0022 class TopLoc_Location;
0023 
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 
0031   DEFINE_STANDARD_ALLOC
0032 
0033   //! Describes types of geometric objects.
0034   //! - Vinert is 3D closed region of space delimited with
0035   //!   Point and surface mesh;
0036   //! - Sinert is surface mesh in 3D space.
0037   typedef enum { Vinert = 0, Sinert } BRepGProp_MeshObjType;
0038 
0039   //! Constructor takes the type of object.
0040   BRepGProp_MeshProps(const BRepGProp_MeshObjType theType) :
0041     myType(theType)
0042   {}
0043 
0044   //! Sets the point relative which the calculation is to be done
0045   void SetLocation(const gp_Pnt& theLocation) { loc = theLocation; }
0046 
0047   //! Computes the global properties of a surface mesh of 3D space.
0048   //! Calculation of surface properties is performed by numerical integration
0049   //! over triangle surfaces using Gauss cubature formulas. 
0050   //! Depending on the mesh object type used in constructor this method can 
0051   //! calculate the surface or volume properties of the mesh.
0052   Standard_EXPORT void Perform(const Handle(Poly_Triangulation)& theMesh,
0053                                const TopLoc_Location& theLoc,
0054                                const TopAbs_Orientation theOri);
0055 
0056   Standard_EXPORT void Perform(const Handle(Poly_Triangulation)& theMesh,
0057                                const TopAbs_Orientation theOri);
0058 
0059   //! Computes the global properties of triangle {p1, p2, p3} relatively 
0060   //! point Apex
0061   //! If isVolume = true, volume properties are calculated
0062   //! otherwise - surface ones
0063   Standard_EXPORT static void CalculateProps(const gp_Pnt& p1, const gp_Pnt& p2, const gp_Pnt& p3,
0064                                              const gp_Pnt& Apex,
0065                                              const Standard_Boolean isVolume,
0066                                              Standard_Real GProps[10],
0067                                              const Standard_Integer NbGaussPoints,
0068                                              const Standard_Real* GaussPnts);
0069 
0070   //! Get type of mesh object
0071   BRepGProp_MeshObjType GetMeshObjType() const
0072   {
0073     return myType;
0074   }
0075 
0076 private: //! @name private fields
0077 
0078 
0079   BRepGProp_MeshObjType myType; //!< Type of geometric object
0080 
0081 };
0082 
0083 #endif // _BRepGProp_MeshProps_HeaderFile