Rasterfarm-SDK
Loading...
Searching...
No Matches
Mesh::TriangleMesh Class Reference

#include <trianglemesh.h>

Inheritance diagram for Mesh::TriangleMesh:
Tree::CubeTree Shape::Geometry Geometry Shape::Cone Shape::Cuboid Shape::Disk Shape::Polygon Shape::PolygonalText Shape::Quad Shape::ShadowVolume Shape::Skeletal Shape::Sphere Shape::TexturedText Shape::Triangle Shape::Wavefront Shape::Wire

Public Types

typedef HeapArray< HalfEdgeIndexArrayHalfEdgeIndexTable
 

Public Member Functions

 TriangleMesh ()
 
 TriangleMesh (const Vertex3fArray &vertex)
 
 TriangleMesh (const TriangleMesh &other)
 
void operator+= (const TriangleMesh &other)
 
 ~TriangleMesh ()
 
void clear ()
 
VertexIndex addVertex (const Vertex3f &vertex)
 
VertexIndexArray addVertexArray (const Vertex3fArray &array)
 
VertexIndexSet getFaceVertexIndices (const FaceIndex fI) const
 
VertexIndexSet getFaceVertexIndices (const Face &face) const
 
VertexIndexArray getFaceContour (FaceIndex fI) const
 
FaceIndex findFace (const VertexIndexArray &array) const
 
Vertex3f getFaceNormal (const Face &face) const
 
Vertex3f getFaceNormal (FaceIndex fI) const
 
TriangleIndex findTriangle (const Triangle &triangle) const
 
bool hasTriangle (VertexIndex vA, VertexIndex vB, VertexIndex vC) const
 
TriangleIndex addTriangle (VertexIndex iA, VertexIndex iB, VertexIndex iC, FaceIndex iF)
 
TriangleIndex addTriangle (const Triangle &t, FaceIndex iF)
 
TriangleIndex addTriangle (const Triangle &triangle)
 
FaceIndexArray findFaces (const Triangle &triangle)
 
void removeTriangle (TriangleIndex index)
 
HalfEdgeIndex addHalfEdge (const HalfEdge &halfEdge)
 
void removeHalfEdge (const HalfEdgeIndex halfEdgeIndex)
 
const HalfEdgeArraygetHalfEdge () const
 
const TriangleArraygetTriangle () const
 
const FaceArraygetFace () const
 
FacegetFace (uint index)
 
Vertex3fArray createContour (const FaceIndex fI) const
 
HalfEdgeArray getFaceHalfEdges (const FaceIndex fI) const
 
HalfEdgeIndexArray getFaceHalfEdgeIndices (const FaceIndex fI) const
 
const HalfEdgegetHalfEdge (const VertexIndex a, const VertexIndex b) const
 
HalfEdgeIndex getHalfEdgeIndex (const VertexIndex a, const VertexIndex b) const
 
const HalfEdgeIndexTablegetHalfEdgeIndexTable () const
 
bool isHalfEdge (const VertexIndex a, const VertexIndex b) const
 
bool isHalfEdge (HalfEdgeIndex index) const
 
bool isFullEdge (const VertexIndex a, const VertexIndex b) const
 
bool isFullEdge (HalfEdgeIndex index) const
 
FaceIndex addFace (const Face &face=Face())
 
void removeFace (FaceIndex faceIndex)
 
VertexIndexArray shortestPath (Mesh::VertexIndex startVertexIndex, Mesh::VertexIndex endVertexIndex)
 
Primitive3D::Triangle createPrimitveTriangle (const Triangle &triangle) const
 
Primitive3D::Triangle createPrimitveTriangle (const TriangleIndex index) const
 
Primitive3D::Segment createPrimitveSegment (const HalfEdge &he) const
 
Primitive3D::Segment createPrimitveSegment (const HalfEdgeIndex index) const
 
- Public Member Functions inherited from Tree::CubeTree
 CubeTree ()
 
 CubeTree (const Vertex3fArray &vertex)
 
 CubeTree (const CubeTree &)
 
virtual ~CubeTree ()
 
bool hasDuplicates ()
 
 operator const Branch & () const
 
 operator const Branch * () const
 
 operator HeapArray< Leaf * > ()
 
bool operator() (const Vertex3f &vA, const Vertex3f &vB) const
 
Leafnearest (const Vertex3f &vertex)
 
Leaffind (const Vertex3f &vertex, float precision=0.0f) const
 
void erase (Leaf *pLeaf)
 
void update (Handle index, const Vertex3f &vertex)
 
void update ()
 
Handle insert (const Vertex3f &vertex)
 
HeapArray< Handle > insert (const Vector3fArray &list)
 
template<typename INDICES >
Vector3fArray getVertices (const INDICES &c) const
 
Vector3fArray getVertices (bool unique=false) const
 
HeapArray< Leaf * > getLeaves () const
 
const Leafoperator[] (Handle index) const
 
Handle operator[] (const Vertex3f &v) const
 
const Vertex3fback () const
 
const Vertex3ffront () const
 
HeapArray< Leaf * >::iterator begin ()
 
HeapArray< Leaf * >::iterator end ()
 
HeapArray< Leaf * >::const_iterator begin () const
 
HeapArray< Leaf * >::const_iterator end () const
 
size_t size () const
 
void clear ()
 

Static Public Member Functions

static bool isHalfEdge (const VertexIndex a, const VertexIndex b, const HalfEdgeIndexTable &table)
 
static bool isHalfEdge (const HalfEdge he, const HalfEdgeIndexTable &table)
 
static bool isFullEdge (const VertexIndex a, const VertexIndex b, const HalfEdgeIndexTable &table)
 
static bool isFullEdge (const HalfEdge he, const HalfEdgeIndexTable &table)
 
static HalfEdgeIndex getHalfEdgeIndex (const VertexIndex a, const VertexIndex b, const HalfEdgeIndexTable &table)
 

Public Attributes

bool planar
 
float boundingRadius
 

Protected Attributes

HalfEdgeIndexTable halfEdgeIndexTable
 
HalfEdgeArray halfEdge
 
TriangleArray triangle
 
FaceArray face
 

Member Typedef Documentation

◆ HalfEdgeIndexTable

Constructor & Destructor Documentation

◆ TriangleMesh() [1/3]

Mesh::TriangleMesh::TriangleMesh ( )

◆ TriangleMesh() [2/3]

Mesh::TriangleMesh::TriangleMesh ( const Vertex3fArray & vertex)

◆ TriangleMesh() [3/3]

Mesh::TriangleMesh::TriangleMesh ( const TriangleMesh & other)

◆ ~TriangleMesh()

Mesh::TriangleMesh::~TriangleMesh ( )

Member Function Documentation

◆ addFace()

FaceIndex Mesh::TriangleMesh::addFace ( const Face & face = Face())

◆ addHalfEdge()

HalfEdgeIndex Mesh::TriangleMesh::addHalfEdge ( const HalfEdge & halfEdge)

◆ addTriangle() [1/3]

TriangleIndex Mesh::TriangleMesh::addTriangle ( const Triangle & t,
FaceIndex iF )
inline

◆ addTriangle() [2/3]

TriangleIndex Mesh::TriangleMesh::addTriangle ( const Triangle & triangle)

◆ addTriangle() [3/3]

TriangleIndex Mesh::TriangleMesh::addTriangle ( VertexIndex iA,
VertexIndex iB,
VertexIndex iC,
FaceIndex iF )

◆ addVertex()

VertexIndex Mesh::TriangleMesh::addVertex ( const Vertex3f & vertex)

Add a vertex to the mesh.

Returns
The corresponding index.

◆ addVertexArray()

VertexIndexArray Mesh::TriangleMesh::addVertexArray ( const Vertex3fArray & array)

◆ clear()

void Mesh::TriangleMesh::clear ( )

◆ createContour()

Vertex3fArray Mesh::TriangleMesh::createContour ( const FaceIndex fI) const

Essentially all the non-shared adjacent edges, sorted by CW orientation.

Returns
An array containing the CW sorted contour vertices.

◆ createPrimitveSegment() [1/2]

Primitive3D::Segment Mesh::TriangleMesh::createPrimitveSegment ( const HalfEdge & he) const

◆ createPrimitveSegment() [2/2]

Primitive3D::Segment Mesh::TriangleMesh::createPrimitveSegment ( const HalfEdgeIndex index) const

◆ createPrimitveTriangle() [1/2]

Primitive3D::Triangle Mesh::TriangleMesh::createPrimitveTriangle ( const Triangle & triangle) const

◆ createPrimitveTriangle() [2/2]

Primitive3D::Triangle Mesh::TriangleMesh::createPrimitveTriangle ( const TriangleIndex index) const

◆ findFace()

FaceIndex Mesh::TriangleMesh::findFace ( const VertexIndexArray & array) const
Returns
the Face containing all of the vertex indices.

◆ findFaces()

FaceIndexArray Mesh::TriangleMesh::findFaces ( const Triangle & triangle)
Parameters
ATriangle to find a suitable Face for.
Returns
An array of Face indices that share HalfEdges and normals.

◆ findTriangle()

TriangleIndex Mesh::TriangleMesh::findTriangle ( const Triangle & triangle) const

A constant-time search for a triangle.

Returns
a valid index if a match is found, regardless of index order and INVALID_HANDLE if not.

◆ getFace() [1/2]

const FaceArray & Mesh::TriangleMesh::getFace ( ) const
inline

◆ getFace() [2/2]

Face & Mesh::TriangleMesh::getFace ( uint index)
inline

◆ getFaceContour()

VertexIndexArray Mesh::TriangleMesh::getFaceContour ( FaceIndex fI) const

For a triangulated-face, the triangles with edges that are not adjacent to another triangle(half-edge &! full-edge) will by definition form a non-intersecting simple polygon contour.

Returns
An array of vertex-indices that form the contour for this face.

◆ getFaceHalfEdgeIndices()

HalfEdgeIndexArray Mesh::TriangleMesh::getFaceHalfEdgeIndices ( const FaceIndex fI) const

The indices of all of the HalfEdges associated with this face.

Returns
An array containing the indices of all the non full-edges ordered by insertion by their respective Triangles.

◆ getFaceHalfEdges()

HalfEdgeArray Mesh::TriangleMesh::getFaceHalfEdges ( const FaceIndex fI) const

All of the HalfEdges associated with this face.

Returns
An array containing all of the non full-edges ordered by insertion by their respective Triangles.

◆ getFaceNormal() [1/2]

Vertex3f Mesh::TriangleMesh::getFaceNormal ( const Face & face) const

◆ getFaceNormal() [2/2]

Vertex3f Mesh::TriangleMesh::getFaceNormal ( FaceIndex fI) const
inline

◆ getFaceVertexIndices() [1/2]

VertexIndexSet Mesh::TriangleMesh::getFaceVertexIndices ( const Face & face) const
Returns
The set of vertex-indices for this face with no-order implied.

◆ getFaceVertexIndices() [2/2]

VertexIndexSet Mesh::TriangleMesh::getFaceVertexIndices ( const FaceIndex fI) const
Returns
The set of vertex-indices for this face with no-order implied.

◆ getHalfEdge() [1/2]

const HalfEdgeArray & Mesh::TriangleMesh::getHalfEdge ( ) const
inline

◆ getHalfEdge() [2/2]

const HalfEdge & Mesh::TriangleMesh::getHalfEdge ( const VertexIndex a,
const VertexIndex b ) const

◆ getHalfEdgeIndex() [1/2]

HalfEdgeIndex Mesh::TriangleMesh::getHalfEdgeIndex ( const VertexIndex a,
const VertexIndex b ) const
Returns
The index in TriangleMesh::halfEdge or INVALID_HANDLE if not defined.

◆ getHalfEdgeIndex() [2/2]

static HalfEdgeIndex Mesh::TriangleMesh::getHalfEdgeIndex ( const VertexIndex a,
const VertexIndex b,
const HalfEdgeIndexTable & table )
static

◆ getHalfEdgeIndexTable()

const HalfEdgeIndexTable & Mesh::TriangleMesh::getHalfEdgeIndexTable ( ) const

◆ getTriangle()

const TriangleArray & Mesh::TriangleMesh::getTriangle ( ) const
inline

◆ hasTriangle()

bool Mesh::TriangleMesh::hasTriangle ( VertexIndex vA,
VertexIndex vB,
VertexIndex vC ) const
inline
Returns
a valid index if a match is found, regardless of index order and INVALID_HANDLE if not.

◆ isFullEdge() [1/4]

static bool Mesh::TriangleMesh::isFullEdge ( const HalfEdge he,
const HalfEdgeIndexTable & table )
inlinestatic
Returns
true if the HalfEdge at this index form a full-edge.

◆ isFullEdge() [2/4]

bool Mesh::TriangleMesh::isFullEdge ( const VertexIndex a,
const VertexIndex b ) const

Checks if the indices form a full-edge.

◆ isFullEdge() [3/4]

static bool Mesh::TriangleMesh::isFullEdge ( const VertexIndex a,
const VertexIndex b,
const HalfEdgeIndexTable & table )
static
Returns
true if the HalfEdge at this index form a full-edge.

◆ isFullEdge() [4/4]

bool Mesh::TriangleMesh::isFullEdge ( HalfEdgeIndex index) const
Returns
true if the HalfEdge at this index form a full-edge.

◆ isHalfEdge() [1/4]

static bool Mesh::TriangleMesh::isHalfEdge ( const HalfEdge he,
const HalfEdgeIndexTable & table )
inlinestatic
Returns
true if both vertices form a half-edge

◆ isHalfEdge() [2/4]

bool Mesh::TriangleMesh::isHalfEdge ( const VertexIndex a,
const VertexIndex b ) const
inline
Returns
true if both vertices form a half-edge.

◆ isHalfEdge() [3/4]

static bool Mesh::TriangleMesh::isHalfEdge ( const VertexIndex a,
const VertexIndex b,
const HalfEdgeIndexTable & table )
static
Returns
true if both vertices form a half-edge.

◆ isHalfEdge() [4/4]

bool Mesh::TriangleMesh::isHalfEdge ( HalfEdgeIndex index) const
Returns
true if the HalfEdge at this index is not a full-edge.

◆ operator+=()

void Mesh::TriangleMesh::operator+= ( const TriangleMesh & other)

◆ removeFace()

void Mesh::TriangleMesh::removeFace ( FaceIndex faceIndex)

◆ removeHalfEdge()

void Mesh::TriangleMesh::removeHalfEdge ( const HalfEdgeIndex halfEdgeIndex)

◆ removeTriangle()

void Mesh::TriangleMesh::removeTriangle ( TriangleIndex index)

◆ shortestPath()

VertexIndexArray Mesh::TriangleMesh::shortestPath ( Mesh::VertexIndex startVertexIndex,
Mesh::VertexIndex endVertexIndex )

For a mesh to be manifold, must pass these tests: 1) each half-edge must be incident to 1 or 2 faces. 2) all faces incident to a ./colertex must form an open or closed fan. 3) faces must be connected by an edge, not a single vertex 4) normals of adjacent faces cannot be opposites(folded)

Returns
true if TriangleMesh is manifold.

Finds the shortest path from start to end vertex with an optional minimal path length.

Parameters
Thestart vertex index.
Theend vertex index.

Member Data Documentation

◆ boundingRadius

float Mesh::TriangleMesh::boundingRadius

The magnitude of the furthest radius from the norm. Used for collision detection and a course-test (level-0).

◆ face

FaceArray Mesh::TriangleMesh::face
protected

◆ halfEdge

HalfEdgeArray Mesh::TriangleMesh::halfEdge
protected

◆ halfEdgeIndexTable

HalfEdgeIndexTable Mesh::TriangleMesh::halfEdgeIndexTable
protected

Record the half-edge index of the vertex[x][y] where x is halfEdge.vertexIndex and y is halfEdge.halfEdgeIndex.vertexIndex

◆ planar

bool Mesh::TriangleMesh::planar

Indicates that this Geometry is 2D. This also implies that it has one face.

◆ triangle

TriangleArray Mesh::TriangleMesh::triangle
protected

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