Public Types | Public Member Functions | Private Attributes
PolygonMesh Class Reference

#include <polygon_mesh.h>

List of all members.

Public Types

typedef vgl_point_3d< double > DPoint
typedef vnl_vector_fixed
< double, 3 > 
DVector3D
typedef vcl_vector< int > Face
typedef vcl_vector< DPointPolygon

Public Member Functions

 PolygonMesh (int num_vertices=100, int num_faces=100)
int add_vertex (DPoint &pt)
 add_vertex.
int set_vertex (int index, DPoint &pt)
 add_vertex.
int add_face (Face &fc)
 add_face.
int set_face (int index, Face &fc)
 add_face.
DPoint get_vertex (int index)
 get_vertex.
Polygon get_face (int index)
 get_face.
DVector3D get_face_normal (int face_index, int vertex_index)
 get_face_normal.
bool read_file (char *filename)
 read_file.
int num_faces () const
int num_vertices () const

Private Attributes

vcl_vector< DPointvertex_list
vcl_vector< Faceface_list

Detailed Description

Definition at line 16 of file polygon_mesh.h.


Member Typedef Documentation

typedef vgl_point_3d<double> PolygonMesh::DPoint

Definition at line 19 of file polygon_mesh.h.

Definition at line 20 of file polygon_mesh.h.

typedef vcl_vector<int> PolygonMesh::Face

Definition at line 21 of file polygon_mesh.h.

typedef vcl_vector<DPoint> PolygonMesh::Polygon

Definition at line 22 of file polygon_mesh.h.


Constructor & Destructor Documentation

PolygonMesh::PolygonMesh ( int  num_vertices = 100,
int  num_faces = 100 
) [inline]

Definition at line 28 of file polygon_mesh.h.


Member Function Documentation

int PolygonMesh::add_face ( Face fc)

add_face.

Add a face to the end of the list of faces

Parameters:
fcThe vertices associated with the face
Returns:
The position of the added face
Author:
Brendan McCane

Definition at line 62 of file polygon_mesh.cxx.

int PolygonMesh::add_vertex ( DPoint pt)

add_vertex.

Add a vertex to the end of the list of vertices

Parameters:
ptThe location of the vertex
Returns:
The position of the added vertex
Author:
Brendan McCane

Definition at line 25 of file polygon_mesh.cxx.

PolygonMesh::Polygon PolygonMesh::get_face ( int  index)

get_face.

Returns a face at the specified location

Parameters:
indexthe position to return
Returns:
a list of vertices
Author:
Brendan McCane

Definition at line 119 of file polygon_mesh.cxx.

PolygonMesh::DVector3D PolygonMesh::get_face_normal ( int  face_index,
int  vertex_index 
)

get_face_normal.

return the normal vector for the given vertex of a given face.

Parameters:
face_indexwhich face
vertex_indexwhich vertex in the face (ie not the vertex index in the entire list of vertices, but the vertex index within the face).
Returns:
the normalised normal vector
Author:
Brendan McCane

Definition at line 209 of file polygon_mesh.cxx.

PolygonMesh::DPoint PolygonMesh::get_vertex ( int  index)

get_vertex.

Returns a vertex at the specified location

Parameters:
indexthe position to return
Returns:
the position of the vertex
Author:
Brendan McCane

Definition at line 98 of file polygon_mesh.cxx.

int PolygonMesh::num_faces ( ) const [inline]

Definition at line 39 of file polygon_mesh.h.

int PolygonMesh::num_vertices ( ) const [inline]

Definition at line 40 of file polygon_mesh.h.

bool PolygonMesh::read_file ( char *  filename)

read_file.

read a mesh in from a file

Parameters:
filenamethe name of the file
Returns:
whether or not the file was successfully read
Author:
Brendan McCane

Definition at line 145 of file polygon_mesh.cxx.

int PolygonMesh::set_face ( int  index,
Face fc 
)

add_face.

Add a face to the prescribed position in the list of faces

Parameters:
fcThe vertices associated with the face
indexWhere to add the face
Returns:
The position of the added face
Author:
Brendan McCane

Definition at line 79 of file polygon_mesh.cxx.

int PolygonMesh::set_vertex ( int  index,
DPoint pt 
)

add_vertex.

Add a vertex to the prescribed position in the list of vertices

Parameters:
ptThe location of the vertex
indexWhere to add the vertex
Returns:
The position of the added vertex
Author:
Brendan McCane

Definition at line 43 of file polygon_mesh.cxx.


Member Data Documentation

vcl_vector<Face> PolygonMesh::face_list [private]

Definition at line 25 of file polygon_mesh.h.

vcl_vector<DPoint> PolygonMesh::vertex_list [private]

Definition at line 24 of file polygon_mesh.h.


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