AGX Dynamics 2.41.1.2
Loading...
Searching...
No Matches
RawMesh.h
Go to the documentation of this file.
1/*
2Copyright 2007-2025. Algoryx Simulation AB.
3
4All AGX source code, intellectual property, documentation, sample code,
5tutorials, scene files and technical white papers, are copyrighted, proprietary
6and confidential material of Algoryx Simulation AB. You may not download, read,
7store, distribute, publish, copy or otherwise disseminate, use or expose this
8material unless having a written signed agreement with Algoryx Simulation AB, or having been
9advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10valid commercial license from Algoryx Simulation AB.
11
12Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13from using this software, unless otherwise stated in written agreements with
14Algoryx 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>
25
26namespace 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:254
#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:208
#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.
agx::Real getVertexArea(size_t vertex) const
Get the area represented by a single vertex.
agx::VectorPOD< agx::UInt > IndexVector
Definition: RawMesh.h:37
const IndexVector & getFaceVertices(size_t face) const
Get the index each vertex in the specified face.
size_t getNumFaces() const
Get the number of faces stored in the mesh.
const IndexVector & getFacesFromVertex(size_t vertex) const
Get the faces which contain a specified vertex.
const agx::String & getName() const
Get the name of 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:120
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