1 // Copyright (c) 2018 OPEN CASCADE SAS
2 // This file is part of commercial software by OPEN CASCADE SAS,
3 // furnished in accordance with the terms and conditions of the contract
4 // and with the inclusion of this copyright notice.
5 // This file or any part thereof may not be provided or otherwise
6 // made available to any third party.
8 // No ownership title to the software is transferred hereby.
10 // OPEN CASCADE SAS makes no representation or warranties with respect to the
11 // performance of this software, and specifically disclaims any responsibility
12 // for any damages, special or consequential, connected with its use.
14 #ifndef _BRepGProp_MeshProps_HeaderFile
15 #define _BRepGProp_MeshProps_HeaderFile
17 #include <Standard.hxx>
18 #include <Standard_DefineAlloc.hxx>
19 #include <Standard_Handle.hxx>
20 #include <Standard_Type.hxx>
21 #include <GProp_GProps.hxx>
22 #include <TopAbs_Orientation.hxx>
23 #include <Poly_Array1OfTriangle.hxx>
24 #include <TColgp_Array1OfPnt.hxx>
26 class Poly_Triangulation;
27 class TopLoc_Location;
31 //! Computes the global properties of a surface mesh. The mesh can be
32 //! interpreted as just a surface or as a piece of volume limited by this surface.
33 class BRepGProp_MeshProps : public GProp_GProps
39 //! Describes types of geometric objects.
40 //! - Vinert is 3D closed region of space delimited with
41 //! Point and surface mesh;
42 //! - Sinert is surface mesh in 3D space.
43 typedef enum { Vinert = 0, Sinert } BRepGProp_MeshObjType;
45 //! Constructor takes the type of object.
46 BRepGProp_MeshProps(const BRepGProp_MeshObjType theType) :
50 //! Sets the point relative which the calculation is to be done
51 void SetLocation(const gp_Pnt& theLocation) { loc = theLocation; }
53 //! Computes the global properties of a surface mesh of 3D space.
54 //! Calculation of surface properties is performed by numerical integration
55 //! over triangle surfaces using Gauss cubature formulas.
56 //! Depending on the mesh object type used in constructor this method can
57 //! calculate the surface or volume properties of the mesh.
58 Standard_EXPORT void Perform(const Handle(Poly_Triangulation)& theMesh,
59 const TopLoc_Location& theLoc,
60 const TopAbs_Orientation theOri);
62 Standard_EXPORT void Perform(const TColgp_Array1OfPnt& theNodes,
63 const Poly_Array1OfTriangle& theTriangles,
64 const TopAbs_Orientation theOri);
66 //! Computes the global properties of triangle {p1, p2, p3} relatively
68 //! If isVolume = true, volume properties are calculated
69 //! otherwise - surface ones
70 Standard_EXPORT static void CalculateProps(const gp_Pnt& p1, const gp_Pnt& p2, const gp_Pnt& p3,
72 const Standard_Boolean isVolume,
73 Standard_Real GProps[10],
74 const Standard_Integer NbGaussPoints,
75 const Standard_Real* GaussPnts);
77 //! Get type of mesh object
78 BRepGProp_MeshObjType GetMeshObjType() const
83 private: //! @name private fields
86 BRepGProp_MeshObjType myType; //!< Type of geometric object
90 #endif // _BRepGProp_MeshProps_HeaderFile