AGX Dynamics  2.35.0.1
RawMesh.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2022. Algoryx Simulation AB.
3 
4 All AGX source code, intellectual property, documentation, sample code,
5 tutorials, scene files and technical white papers, are copyrighted, proprietary
6 and confidential material of Algoryx Simulation AB. You may not download, read,
7 store, distribute, publish, copy or otherwise disseminate, use or expose this
8 material unless having a written signed agreement with Algoryx Simulation AB, or having been
9 advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10 valid commercial license from Algoryx Simulation AB.
11 
12 Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13 from using this software, unless otherwise stated in written agreements with
14 Algoryx Simulation AB.
15 */
16 
17 #ifndef AGXUTIL_RAWMESH_H
18 #define AGXUTIL_RAWMESH_H
19 
20 #include <agx/Vec3.h>
21 #include <vector>
22 #include <agx/Vector.h>
23 #include <agx/Referenced.h>
24 #include <agxStream/Serializable.h>
25 
26 namespace agxUtil
27 {
30 
35  {
36  public:
38 
39  // Used for serialization
41 
42  RawMesh(const agx::String& meshName);
43 
49  size_t getNumVertices() const;
50 
55  size_t getNumFaces() const;
56 
62  size_t addVertex(const agx::Vec3& position);
63 
70  size_t addFace(const IndexVector& vertices);
71 
77  agx::Vec3 getVertexPosition(size_t vertex) const;
78 
87  agx::Real getFaceArea(size_t face) const;
88 
93  agx::Real getVertexArea(size_t vertex) const;
99 
104  const IndexVector& getFaceVertices(size_t face) const;
105 
111  const IndexVector& getFacesFromVertex(size_t vertex) const;
112 
117  const agx::String& getName() const;
118 
120 
121  private:
122  agx::Real calculateFaceArea(size_t face) const;
123 
124  private:
125  agx::String m_name;
126  agx::Real m_totalArea;
127 
128  agx::Vector<agx::Vec3> m_vertices;
129  agx::Vector<agx::Real> m_vertexAreas;
130  agx::Vector< IndexVector > m_vertexToFaces;
131 
133  agx::Vector<agx::Real> m_faceAreas;
134  };
135 }
136 
137 #endif
138 
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:248
#define AGXSTREAM_DECLARE_SERIALIZABLE(T)
Use this in a Serializable class to add the required methods Important: Use full namespace in the dec...
Definition: Serializable.h:207
#define AGXPHYSICS_EXPORT
#define AGX_DECLARE_VECTOR_TYPES(type)
Definition: agx/Vector.h:34
This class is an abstract base class for all classes that can be stored and retrieved from an Archive...
Definition: Serializable.h:45
A class to hold a general represenation of a mesh with arbitrary number of vertices in a face.
Definition: RawMesh.h:35
agx::Real getTotalArea() const
Get the area of all the triangles calculated as described for getFaceArea.
const IndexVector & getFacesFromVertex(size_t vertex) const
Get the faces which contain a specified vertex.
agx::Real getVertexArea(size_t vertex) const
Get the area represented by a single vertex.
const IndexVector & getFaceVertices(size_t face) const
Get the index each vertex in the specified face.
agx::VectorPOD< agx::UInt > IndexVector
Definition: RawMesh.h:37
const agx::String & getName() const
Get the name of the mesh.
size_t getNumFaces() const
Get the number of faces stored in the mesh.
RawMesh(const agx::String &meshName)
agx::Vec3 getVertexPosition(size_t vertex) const
Get the position of a vertex.
size_t addFace(const IndexVector &vertices)
Add a face to the object stored with the specified vertices.
size_t getNumVertices() const
Get the number of vertices stored in the mesh.
size_t addVertex(const agx::Vec3 &position)
Add a vertex to the object on the specified position.
agx::Real getFaceArea(size_t face) const
Get the area of a face.
Base class providing referencing counted objects.
Definition: Referenced.h:114
Vector containing 'raw' data.
Definition: agx/Vector.h:246
Templated vector class.
Definition: agx/Vector.h:53
The agxUtil namespace contain classes and methods for utility functionality.
double Real
Definition: Real.h:42