AGX Dynamics 2.41.1.2
Loading...
Searching...
No Matches
agxUtil::RawMesh Class Reference

A class to hold a general represenation of a mesh with arbitrary number of vertices in a face. More...

#include <RawMesh.h>

+ Inheritance diagram for agxUtil::RawMesh:

Public Types

typedef agx::VectorPOD< agx::UIntIndexVector
 

Public Member Functions

 RawMesh ()
 
 RawMesh (const agx::String &meshName)
 
size_t addFace (const IndexVector &vertices)
 Add a face to the object stored with the specified vertices.
 
size_t addVertex (const agx::Vec3 &position)
 Add a vertex to the object on the specified position.
 
 AGXSTREAM_DECLARE_SERIALIZABLE_BASE (agxUtil::RawMesh)
 
agx::Real getFaceArea (size_t face) const
 Get the area of a face.
 
const IndexVectorgetFacesFromVertex (size_t vertex) const
 Get the faces which contain a specified vertex.
 
const IndexVectorgetFaceVertices (size_t face) const
 Get the index each vertex in the specified face.
 
const agx::StringgetName () const
 Get the name of the mesh.
 
size_t getNumFaces () const
 Get the number of faces stored in the mesh.
 
size_t getNumVertices () const
 Get the number of vertices stored in the mesh.
 
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::Vec3 getVertexPosition (size_t vertex) const
 Get the position of a vertex.
 
- Public Member Functions inherited from agx::Referenced
 Referenced ()
 Default constructor.
 
 Referenced (const Referenced &)
 
template<typename T >
T * as ()
 Subclass casting.
 
template<typename T >
const T * as () const
 
template<typename T >
T * asSafe ()
 Safe subclass casting, return nullptr if template type does not match.
 
template<typename T >
const T * asSafe () const
 
int getReferenceCount () const
 
template<typename T >
bool is () const
 Subclass test.
 
Referencedoperator= (const Referenced &)
 Assignment operator. Will increment the number of references to the referenced object.
 
void reference (void *ptr=nullptr) const
 Explicitly increment the reference count by one, indicating that this object has another pointer which is referencing it.
 
void unreference (void *ptr=nullptr) const
 Decrement the reference count by one, indicating that a pointer to this object is referencing it.
 
void unreference_nodelete () const
 Decrement the reference count by one, indicating that a pointer to this object is referencing it.
 
- Public Member Functions inherited from agxStream::Serializable
virtual ~Serializable ()
 Destructor for normal C++ use but hidden from SWIG bindings.
 
virtual const char * getClassName () const
 
bool getEnableSerialization () const
 
bool getEnableUuidGeneration ()
 
agx::UInt32 getIndex () const
 This index is given at creation of this object.
 
virtual StorageAgent * getStorageAgent () const =0
 
agx::Uuid getUuid () const
 
bool isFinished () const
 
void setEnableSerialization (bool flag)
 Set to false to disable serialization of this object.
 
void setFinished ()
 Tells this class that it is restored correctly and should not be deleted during destruction of an Archive.
 
void setUuid (const agx::Uuid &uuid)
 Explicitly set a Uuid on a serializable object.
 

Static Public Member Functions

static agxStream::Serializablecreate (agxStream::InputArchive &)
 
- Static Public Member Functions inherited from agx::Referenced
template<typename T >
static bool ValidateCast (const Referenced *object)
 
- Static Public Member Functions inherited from agxStream::Serializable
static void setEnableUuidGeneration (bool flag)
 Specify if there should be UUID:s generated for each new Serializable object. By default it is enabled.
 

Additional Inherited Members

- Protected Member Functions inherited from agx::Referenced
virtual ~Referenced ()
 Destructor.
 
void allocateObserverVector () const
 
void deleteUsingDeleteHandler () const
 
- Protected Member Functions inherited from agxStream::Serializable
 Serializable ()
 Default constructor.
 
 Serializable (const Serializable &other)
 Copy constructor.
 
void generateUuid ()
 
- Static Protected Member Functions inherited from agx::Referenced
static DeleteHandlergetDeleteHandler ()
 
static void setDeleteHandler (DeleteHandler *handler)
 Internal: Set a DeleteHandler to which deletion of all referenced counted objects will be delegated to.
 
- Protected Attributes inherited from agx::Referenced
Mutex m_mutex
 
ObserverContainer m_observers
 
AtomicValue m_refCount
 

Detailed Description

A class to hold a general represenation of a mesh with arbitrary number of vertices in a face.

Definition at line 34 of file RawMesh.h.

Member Typedef Documentation

◆ IndexVector

Definition at line 37 of file RawMesh.h.

Constructor & Destructor Documentation

◆ RawMesh() [1/2]

agxUtil::RawMesh::RawMesh ( )

◆ RawMesh() [2/2]

agxUtil::RawMesh::RawMesh ( const agx::String meshName)

Member Function Documentation

◆ addFace()

size_t agxUtil::RawMesh::addFace ( const IndexVector vertices)

Add a face to the object stored with the specified vertices.

The vertices is assumed to be stored clockwise from the 'up' side.

Parameters
verticesthe IDs of the vertices of the face
Returns
the ID of the added face

◆ addVertex()

size_t agxUtil::RawMesh::addVertex ( const agx::Vec3 position)

Add a vertex to the object on the specified position.

Parameters
positionthe position of the added vertex
Returns
the ID of the added vertex

◆ AGXSTREAM_DECLARE_SERIALIZABLE_BASE()

agxUtil::RawMesh::AGXSTREAM_DECLARE_SERIALIZABLE_BASE ( agxUtil::RawMesh  )

◆ create()

static agxStream::Serializable * agxUtil::RawMesh::create ( agxStream::InputArchive )
inlinestatic

Definition at line 119 of file RawMesh.h.

◆ getFaceArea()

agx::Real agxUtil::RawMesh::getFaceArea ( size_t  face) const

Get the area of a face.

This is calculated by taking the mid point of all the vertices, and then calculating the area of each triangle defined by two neighbours and the mid point. Unfortunately, this only gives the correct answer if the polygon is convex.

Parameters
facethe ID of the face
Returns
the area of the face

◆ getFacesFromVertex()

const IndexVector & agxUtil::RawMesh::getFacesFromVertex ( size_t  vertex) const

Get the faces which contain a specified vertex.

Parameters
vertexthe ID of the vertex
Returns
a list of the IDs of all the faces

◆ getFaceVertices()

const IndexVector & agxUtil::RawMesh::getFaceVertices ( size_t  face) const

Get the index each vertex in the specified face.

They are ordered clockwise, with the last index being connected to the first.

◆ getName()

const agx::String & agxUtil::RawMesh::getName ( ) const

Get the name of the mesh.

Returns
the name which the mesh is initialized with

◆ getNumFaces()

size_t agxUtil::RawMesh::getNumFaces ( ) const

Get the number of faces stored in the mesh.

Returns
the number of faces stored in the object

◆ getNumVertices()

size_t agxUtil::RawMesh::getNumVertices ( ) const

Get the number of vertices stored in the mesh.

Observe, that depending on initialization, not all vertices need to be part of a face.

Returns
the number of vertices stored in the object

◆ getTotalArea()

agx::Real agxUtil::RawMesh::getTotalArea ( ) const

Get the area of all the triangles calculated as described for getFaceArea.

Returns
the total area of the mesh

◆ getVertexArea()

agx::Real agxUtil::RawMesh::getVertexArea ( size_t  vertex) const

Get the area represented by a single vertex.

This is calculated as an equal part of each face the vertex is part of.

◆ getVertexPosition()

agx::Vec3 agxUtil::RawMesh::getVertexPosition ( size_t  vertex) const

Get the position of a vertex.

Parameters
vertexthe ID of the vertex
Returns
the position of the vertex

The documentation for this class was generated from the following file: