Package toxi.geom.mesh
Interface Mesh3D
- All Known Implementing Classes:
TriangleMesh
,WETriangleMesh
public interface Mesh3D
Common interface for 3D (triangle) mesh containers.
-
Method Summary
Modifier and TypeMethodDescriptionAdds the given 3 points as triangle face to the mesh.Adds the given 3 points as triangle face to the mesh and assigns the given texture coordinates to each vertex.center
(ReadonlyVec3D origin) Centers the mesh around the given pivot point (the centroid of its AABB).clear()
Clears all counters, and vertex & face buffers.Computes the mesh centroid, the average position of all vertices.Re-calculates all face normals.Computes the smooth vertex normals for the entire mesh.Changes the vertex order of faces such that their normal is facing away from the mesh centroid.Flips the vertex ordering between clockwise and anti-clockwise.Flips all vertices along the Y axis and reverses the vertex ordering of all faces to compensate and keep the direction of normals intact.Computes & returns the axis-aligned bounding box of the mesh.Computes & returns the bounding sphere of the mesh.getFaces()
int
Returns the number of triangles used.int
Returns the number of actual vertices used (unique vertices).
-
Method Details
-
addFace
Adds the given 3 points as triangle face to the mesh. The assumed vertex order is anti-clockwise.- Parameters:
a
-b
-c
-
-
addFace
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
-
addFace
-
addMesh
-
center
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
-
getFaces
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
Collection<Vertex> getVertices() -
init
-
setName
-