BALL::TSurface< T > Class Template Reference

#include <BALL/MATHS/surface.h>

Inheritance diagram for BALL::TSurface< T >:
BALL::VIEW::Mesh

List of all members.

Classes

class  Triangle

Public Types

Type definitions
typedef TVector3< T > Vertex
 A vertex.
typedef TVector3< T > Normal
 A normal.

Public Member Functions

Constructors and Destructors
 TSurface ()
 TSurface (const TSurface &surface)
virtual ~TSurface ()
Assignment
void set (const TSurface &surface)
TSurfaceoperator= (const TSurface &surface)
void get (TSurface &surface) const
void clear ()
void readMSMSFile (const String &vert_filename, const String &face_filename) throw (Exception::FileNotFound)
Accessors
float getArea () const
Size getNumberOfTriangles () const
 Return the number of triangles.
Size getNumberOfVertices () const
 Return the number of vertices.
Size getNumberOfNormals () const
 Return the number of normals.
TrianglegetTriangle (Position index)
 Return a triangle with a given index.
const TrianglegetTriangle (Position index) const
 Return a triangle with a given index.
void clearTriangles ()
 Clear all triangles.
void resizeTriangles (Size size)
 Resize the triangle array.
void pushBackTriangle (const Triangle &triangle)
 Add a triangle.
VertexgetVertex (Position index)
 Return the position of a vertex.
const VertexgetVertex (Position index) const
 Return the position of a vertex.
void clearVertices ()
 Clear all vertices.
void resizeVertices (Size size)
 Resize the vertex array.
void pushBackVertex (const Vertex &vertex)
 Add a vertex.
NormalgetNormal (Position index)
 Return the position of a normal.
const NormalgetNormal (Position index) const
 Return the position of a normal.
void clearNormals ()
 Clear all normals.
void resizeNormals (Size size)
 Resize the normal array.
void pushBackNormal (const Normal &n)
 Add a normal.
Predicates
bool operator== (const TSurface &surface) const
bool operator!= (const TSurface &surface) const

Public Attributes

Attributes
vector< Vertexvertex
 the vertices
vector< Normalnormal
 the normals for each vertex
vector< Triangletriangle
 the triangles

Detailed Description

template<typename T>
class BALL::TSurface< T >

Generic Three-dimensional Surface class. This class describes a three-dimensional triangulated surface. Each triangle is represented by three indices to vertices (as described by the TSurface::Triangle ). Each of the vertices has a position and possibly a normal vector associated.


Member Typedef Documentation

template<typename T>
typedef TVector3<T> BALL::TSurface< T >::Normal

A normal.

template<typename T>
typedef TVector3<T> BALL::TSurface< T >::Vertex

A vertex.


Constructor & Destructor Documentation

template<typename T >
BALL::TSurface< T >::TSurface ( )

This is required for windows dlls

template<typename T >
BALL::TSurface< T >::TSurface ( const TSurface< T > &  surface)
template<typename T >
BALL::TSurface< T >::~TSurface ( ) [virtual]

Member Function Documentation

template<typename T >
void BALL::TSurface< T >::clear ( )
template<typename T >
BALL_INLINE void BALL::TSurface< T >::clearNormals ( )

Clear all normals.

template<typename T >
BALL_INLINE void BALL::TSurface< T >::clearTriangles ( )

Clear all triangles.

template<typename T >
BALL_INLINE void BALL::TSurface< T >::clearVertices ( )

Clear all vertices.

template<typename T >
void BALL::TSurface< T >::get ( TSurface< T > &  surface) const
template<typename T >
float BALL::TSurface< T >::getArea ( ) const

Compute the surface area. The area is computed as the sum of the areas of all triangles.

template<typename T >
BALL_INLINE const TSurface< T >::Normal & BALL::TSurface< T >::getNormal ( Position  index) const

Return the position of a normal.

template<typename T >
BALL_INLINE TSurface< T >::Normal & BALL::TSurface< T >::getNormal ( Position  index)

Return the position of a normal.

template<typename T >
BALL_INLINE Size BALL::TSurface< T >::getNumberOfNormals ( ) const

Return the number of normals.

template<typename T >
BALL_INLINE Size BALL::TSurface< T >::getNumberOfTriangles ( ) const

Return the number of triangles.

template<typename T >
BALL_INLINE Size BALL::TSurface< T >::getNumberOfVertices ( ) const

Return the number of vertices.

template<typename T >
BALL_INLINE TSurface< T >::Triangle & BALL::TSurface< T >::getTriangle ( Position  index)

Return a triangle with a given index.

template<typename T >
BALL_INLINE const TSurface< T >::Triangle & BALL::TSurface< T >::getTriangle ( Position  index) const

Return a triangle with a given index.

template<typename T >
BALL_INLINE const TSurface< T >::Vertex & BALL::TSurface< T >::getVertex ( Position  index) const

Return the position of a vertex.

template<typename T >
BALL_INLINE TSurface< T >::Vertex & BALL::TSurface< T >::getVertex ( Position  index)

Return the position of a vertex.

template<typename T >
bool BALL::TSurface< T >::operator!= ( const TSurface< T > &  surface) const
template<typename T >
TSurface< T > & BALL::TSurface< T >::operator= ( const TSurface< T > &  surface)
template<typename T >
bool BALL::TSurface< T >::operator== ( const TSurface< T > &  surface) const
template<typename T>
void BALL::TSurface< T >::pushBackNormal ( const Normal n)

Add a normal.

template<typename T >
BALL_INLINE void BALL::TSurface< T >::pushBackTriangle ( const Triangle triangle)

Add a triangle.

template<typename T>
void BALL::TSurface< T >::pushBackVertex ( const Vertex vertex)

Add a vertex.

template<typename T >
void BALL::TSurface< T >::readMSMSFile ( const String vert_filename,
const String face_filename 
) throw (Exception::FileNotFound)

Read from MSMS file. Read the contents of the vertex and faces file created by Michael Sanners software MSMS.

References BALL::String::countFields(), BALL::String::getline(), BALL::String::split(), BALL::TSurface< T >::Triangle::v1, BALL::TSurface< T >::Triangle::v2, and BALL::TSurface< T >::Triangle::v3.

template<typename T >
BALL_INLINE void BALL::TSurface< T >::resizeNormals ( Size  size)

Resize the normal array.

template<typename T >
BALL_INLINE void BALL::TSurface< T >::resizeTriangles ( Size  size)

Resize the triangle array.

template<typename T >
BALL_INLINE void BALL::TSurface< T >::resizeVertices ( Size  size)

Resize the vertex array.

template<typename T >
void BALL::TSurface< T >::set ( const TSurface< T > &  surface)

Member Data Documentation