org.critterai.nmgen
Class TriangleMesh

java.lang.Object
  extended by org.critterai.nmgen.TriangleMesh

public final class TriangleMesh
extends Object

Represents the a triangle mesh created by the navigation mesh generation process.

WARNING: The core data within this class is unprotected.


Field Summary
 int[] indices
          Triangles in the mesh in the forma (vertAIndex, vertBIndex, vertCIndex) where the vertices are wrapped clockwise.
 int[] triangleRegions
          The region to which each triangle belongs.
 float[] vertices
          Vertices for the triangle mesh in the forma (x, y, z)
 
Constructor Summary
TriangleMesh()
           
 
Method Summary
 int getTriangleRegion(int index)
          Gets the region ID associated with a triangle
 float[] getTriangleVerts(int index)
          Gets the vertices for a particular triangle in the form (vertAx, vertAy, vertAz, vertBx, vertBy, vertBz, vertCx, vertCy, vertCz)
 int triangleCount()
          The number of triangles in the mesh.
 int vertCount()
          The number of vertices in the mesh.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

vertices

public float[] vertices
Vertices for the triangle mesh in the forma (x, y, z)


indices

public int[] indices
Triangles in the mesh in the forma (vertAIndex, vertBIndex, vertCIndex) where the vertices are wrapped clockwise.


triangleRegions

public int[] triangleRegions
The region to which each triangle belongs.

Index corresponds to the indices array index.

Constructor Detail

TriangleMesh

public TriangleMesh()
Method Detail

getTriangleRegion

public int getTriangleRegion(int index)
Gets the region ID associated with a triangle

Parameters:
index - The index of the triangle.
Returns:
The region ID of the triangle. Or -1 if the index is invalid.

getTriangleVerts

public float[] getTriangleVerts(int index)
Gets the vertices for a particular triangle in the form (vertAx, vertAy, vertAz, vertBx, vertBy, vertBz, vertCx, vertCy, vertCz)

Parameters:
index - The index of the triangle to retrieve.
Returns:
The vertices in the specified triangle. Or null if the index is invalid.

triangleCount

public int triangleCount()
The number of triangles in the mesh.

Returns:
The number of triangles in the mesh.

vertCount

public int vertCount()
The number of vertices in the mesh.

Returns:
The number of vertices in the mesh.


Project Home and Source Code

Copyright 2010 Stephen Pratt. All rights reserved. Use is subject to license terms.