toxi.geom.mesh
Interface Mesh3D

All Known Implementing Classes:
TriangleMesh, WETriangleMesh

public interface Mesh3D

Common interface for 3D (triangle) mesh containers.


Method Summary
 Mesh3D addFace(Vec3D a, Vec3D b, Vec3D c)
          Adds the given 3 points as triangle face to the mesh.
 Mesh3D addFace(Vec3D a, Vec3D b, Vec3D c, Vec2D uvA, Vec2D uvB, Vec2D uvC)
          Adds the given 3 points as triangle face to the mesh and assigns the given texture coordinates to each vertex.
 Mesh3D addFace(Vec3D a, Vec3D b, Vec3D c, Vec3D n)
           
 Mesh3D addFace(Vec3D a, Vec3D b, Vec3D c, Vec3D n, Vec2D uvA, Vec2D uvB, Vec2D uvC)
           
 Mesh3D addMesh(Mesh3D mesh)
           
 AABB center(ReadonlyVec3D origin)
          Centers the mesh around the given pivot point (the centroid of its AABB).
 Mesh3D clear()
          Clears all counters, and vertex & face buffers.
 Vec3D computeCentroid()
          Computes the mesh centroid, the average position of all vertices.
 Mesh3D computeFaceNormals()
          Re-calculates all face normals.
 Mesh3D computeVertexNormals()
          Computes the smooth vertex normals for the entire mesh.
 Mesh3D faceOutwards()
          Changes the vertex order of faces such that their normal is facing away from the mesh centroid.
 Mesh3D flipVertexOrder()
          Flips the vertex ordering between clockwise and anti-clockwise.
 Mesh3D flipYAxis()
          Flips all vertices along the Y axis and reverses the vertex ordering of all faces to compensate and keep the direction of normals intact.
 AABB getBoundingBox()
          Computes & returns the axis-aligned bounding box of the mesh.
 Sphere getBoundingSphere()
          Computes & returns the bounding sphere of the mesh.
 Vertex getClosestVertexToPoint(ReadonlyVec3D p)
           
 java.util.Collection<Face> getFaces()
           
 int getNumFaces()
          Returns the number of triangles used.
 int getNumVertices()
          Returns the number of actual vertices used (unique vertices).
 java.util.Collection<Vertex> getVertices()
           
 Mesh3D init(java.lang.String name, int numV, int numF)
           
 Mesh3D setName(java.lang.String name)
           
 

Method Detail

addFace

Mesh3D addFace(Vec3D a,
               Vec3D b,
               Vec3D c)
Adds the given 3 points as triangle face to the mesh. The assumed vertex order is anti-clockwise.

Parameters:
a -
b -
c -

addFace

Mesh3D addFace(Vec3D a,
               Vec3D b,
               Vec3D c,
               Vec2D uvA,
               Vec2D uvB,
               Vec2D uvC)
Adds the given 3 points as triangle face to the mesh and assigns the given texture coordinates to each vertex. The assumed vertex order is anti-clockwise.

Parameters:
a -
b -
c -
uvA -
uvB -
uvC -
Returns:
itself

addFace

Mesh3D addFace(Vec3D a,
               Vec3D b,
               Vec3D c,
               Vec3D n)

addFace

Mesh3D addFace(Vec3D a,
               Vec3D b,
               Vec3D c,
               Vec3D n,
               Vec2D uvA,
               Vec2D uvB,
               Vec2D uvC)

addMesh

Mesh3D addMesh(Mesh3D mesh)

center

AABB center(ReadonlyVec3D origin)
Centers the mesh around the given pivot point (the centroid of its AABB). Method also updates & returns the new bounding box.

Parameters:
origin - new centroid or null (defaults to {0,0,0})

clear

Mesh3D clear()
Clears all counters, and vertex & face buffers.


computeCentroid

Vec3D computeCentroid()
Computes the mesh centroid, the average position of all vertices.

Returns:
centre point

computeFaceNormals

Mesh3D computeFaceNormals()
Re-calculates all face normals.


computeVertexNormals

Mesh3D computeVertexNormals()
Computes the smooth vertex normals for the entire mesh.

Returns:
itself

faceOutwards

Mesh3D faceOutwards()
Changes the vertex order of faces such that their normal is facing away from the mesh centroid.

Returns:
itself

flipVertexOrder

Mesh3D flipVertexOrder()
Flips the vertex ordering between clockwise and anti-clockwise. Face normals are updated automatically too.

Returns:
itself

flipYAxis

Mesh3D flipYAxis()
Flips all vertices along the Y axis and reverses the vertex ordering of all faces to compensate and keep the direction of normals intact.

Returns:
itself

getBoundingBox

AABB getBoundingBox()
Computes & returns the axis-aligned bounding box of the mesh.

Returns:
bounding box

getBoundingSphere

Sphere getBoundingSphere()
Computes & returns the bounding sphere of the mesh. The origin of the sphere is the mesh's centroid.

Returns:
bounding sphere

getClosestVertexToPoint

Vertex getClosestVertexToPoint(ReadonlyVec3D p)

getFaces

java.util.Collection<Face> getFaces()

getNumFaces

int getNumFaces()
Returns the number of triangles used.

Returns:
face count

getNumVertices

int getNumVertices()
Returns the number of actual vertices used (unique vertices).

Returns:
vertex count

getVertices

java.util.Collection<Vertex> getVertices()

init

Mesh3D init(java.lang.String name,
            int numV,
            int numF)

setName

Mesh3D setName(java.lang.String name)