de.grogra.vecmath.geom
Interface Mesh

All Known Implementing Classes:
PolygonArray, SubPatch

public interface Mesh

Instances of this interface define a polygonal mesh which can be used in MeshVolume to define a volume. The polygons are obtained through getPolygon(int, int[], int[]) as index arrays into the list of vertices which is obtained through getVertex(int, javax.vecmath.Tuple3d) and the list of normals which is obtained through getNormal(int, javax.vecmath.Tuple3d).

Author:
Ole Kniemeyer

Method Summary
 int getMaxEdgeCount()
          Returns the maximum number of edges of a single polygon of the mesh.
 void getNormal(int index, Tuple3d out)
          Gets the normal vector of normal index.
 int getNormalCount()
          Returns the number of normals of the mesh.
 int getPolygon(int index, int[] indicesOut, int[] normalsOut)
          Writes the vertex indices of polygon index to indicesOut and the normal indices to normalsOut and returns the number of vertices of the polygon.
 int getPolygonCount()
          Returns the number of polygons of the mesh.
 void getUV(int index, Tuple2d out)
          Gets the uv coordinates of vertex index.
 void getVertex(int index, Tuple3d out)
          Gets the spatial vertex coordinates of vertex index.
 int getVertexCount()
          Returns the number of vertices of the mesh.
 boolean isClosed()
          Indicates whether this mesh is a closed surface or not.
 boolean isPolygonPlanar(int index)
          Returns true iff the polygon number index is planar.
 

Method Detail

getMaxEdgeCount

int getMaxEdgeCount()
Returns the maximum number of edges of a single polygon of the mesh.

Returns:
maximum number of edges

getNormal

void getNormal(int index,
               Tuple3d out)
Gets the normal vector of normal index. The normal vector is not necessarily normalized.

Parameters:
index - normal number
out - normal vector will be placed in here

getNormalCount

int getNormalCount()
Returns the number of normals of the mesh.

Returns:
number of normals

getPolygon

int getPolygon(int index,
               int[] indicesOut,
               int[] normalsOut)
Writes the vertex indices of polygon index to indicesOut and the normal indices to normalsOut and returns the number of vertices of the polygon. If the mesh is closed (see isClosed()), inside and outside are determined by the ordering of the vertices: when seen from the outside, vertices have to be oriented in a counter-clockwise manner. Then also the normal vectors have to point to the outside.

Parameters:
index - polygon number
indicesOut - the vertex indices will be placed in here
normalsOut - the normal indices will be placed in here
Returns:
number of vertex indices of polygon

getPolygonCount

int getPolygonCount()
Returns the number of polygons of the mesh.

Returns:
number of polygons

getUV

void getUV(int index,
           Tuple2d out)
Gets the uv coordinates of vertex index.

Parameters:
index - vertex number
out - uv coordinates will be placed in here

getVertex

void getVertex(int index,
               Tuple3d out)
Gets the spatial vertex coordinates of vertex index.

Parameters:
index - vertex number
out - vertex coordinates will be placed in here

getVertexCount

int getVertexCount()
Returns the number of vertices of the mesh.

Returns:
number of vertices

isClosed

boolean isClosed()
Indicates whether this mesh is a closed surface or not. If it is closed, normal vectors have to point to the exterior.

Returns:
is surface closed?

isPolygonPlanar

boolean isPolygonPlanar(int index)
Returns true iff the polygon number index is planar.

Parameters:
index - polygon number
Returns:
is polygon planar?