Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## toxi.geom.mesh
Class WETriangleMesh

    java.lang.Object
      toxi.geom.mesh.TriangleMesh
          toxi.geom.mesh.WETriangleMesh

All Implemented Interfaces:
  Intersector3D, Mesh3D

    public class WETriangleMesh

extends TriangleMesh

A class to dynamically build, manipulate & export triangle meshes. Meshes are build face by face. The class automatically re-uses existing vertices and can create smooth vertex normals. Vertices and faces are directly accessible for speed & convenience.

Field Summary
`java.util.LinkedHashMap<Line3D,WingedEdge>` | `edges` WEVertex buffer & lookup index when adding new faces

Fields inherited from class toxi.geom.mesh.TriangleMesh
`DEFAULT_NUM_FACES, DEFAULT_NUM_VERTICES, DEFAULT_STRIDE, faces, name, vertices`

Constructor Summary
`WETriangleMesh()`
`WETriangleMesh(java.lang.String name)` Creates a new mesh instance with initial default buffer sizes.
`WETriangleMesh(java.lang.String name, int numV, int numF)` Creates a new mesh instance with the given initial buffer sizes.

Method Summary
`WETriangleMesh` | `addFace(Vec3D a, Vec3D b, Vec3D c)` Adds the given 3 points as triangle face to the mesh.
`WETriangleMesh` | `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.
`WETriangleMesh` | `addFace(Vec3D a, Vec3D b, Vec3D c, Vec3D n)`
`WETriangleMesh` | `addFace(Vec3D a, Vec3D b, Vec3D c, Vec3D n, Vec2D uvA, Vec2D uvB, Vec2D uvC)`
`WETriangleMesh` | `addMesh(Mesh3D m)` Adds all faces from the given mesh to this one.
`AABB` | `center(ReadonlyVec3D origin)` Centers the mesh around the given pivot point (the centroid of its AABB).
`WETriangleMesh` | `clear()` Clears all counters, and vertex & face buffers.
`WETriangleMesh` | `copy()` Creates a deep clone of the mesh.
`WETriangleMesh` | `flipVertexOrder()` Flips the vertex ordering between clockwise and anti-clockwise.
`WETriangleMesh` | `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.
`WEVertex` | `getClosestVertexToPoint(ReadonlyVec3D p)`
`WETriangleMesh` | `getRotatedAroundAxis(Vec3D axis, float theta)`
`WETriangleMesh` | `getRotatedX(float theta)`
`WETriangleMesh` | `getRotatedY(float theta)`
`WETriangleMesh` | `getRotatedZ(float theta)`
`WETriangleMesh` | `getScaled(float scale)`
`WETriangleMesh` | `getScaled(Vec3D scale)`
`WETriangleMesh` | `getTranslated(Vec3D trans)`
`WEVertex` | `getVertexAtPoint(Vec3D v)`
`WEVertex` | `getVertexForID(int id)`
`WETriangleMesh` | `init(java.lang.String name, int numV, int numF)`
`WETriangleMesh` | `pointTowards(ReadonlyVec3D dir)` Rotates the mesh in such a way so that its "forward" axis is aligned with the given direction.
`WETriangleMesh` | `pointTowards(ReadonlyVec3D dir, ReadonlyVec3D forward)` Rotates the mesh in such a way so that its "forward" axis is aligned with the given direction.
`void` | `rebuildIndex()`
`void` | `removeFace(Face f)`
`void` | `removeUnusedVertices()`
`void` | `removeVertices(java.util.Collection<Vertex> selection)`
`WETriangleMesh` | `rotateAroundAxis(Vec3D axis, float theta)`
`WETriangleMesh` | `rotateX(float theta)`
`WETriangleMesh` | `rotateY(float theta)`
`WETriangleMesh` | `rotateZ(float theta)`
`WETriangleMesh` | `scale(float scale)`
`WETriangleMesh` | `scale(Vec3D scale)`
`void` | `splitEdge(ReadonlyVec3D a, ReadonlyVec3D b, SubdivisionStrategy subDiv)`
`void` | `splitEdge(WingedEdge e, SubdivisionStrategy subDiv)`
`void` | `subdivide()`
`void` | `subdivide(float minLength)`
`void` | `subdivide(SubdivisionStrategy subDiv)`
`void` | `subdivide(SubdivisionStrategy subDiv, float minLength)`
`void` | `subdivideFaceEdges(java.util.List<WEFace> faces, SubdivisionStrategy subDiv, float minLength)`
`java.lang.String` | `toString()`
`WETriangleMesh` | `transform(Matrix4x4 mat)` Applies the given matrix transform to all mesh vertices and updates all face normals.
`WETriangleMesh` | `transform(Matrix4x4 mat, boolean updateNormals)` Applies the given matrix transform to all mesh vertices.
`WETriangleMesh` | `translate(Vec3D trans)`

Methods inherited from class toxi.geom.mesh.TriangleMesh
`computeCentroid, computeFaceNormals, computeVertexNormals, faceOutwards, getBoundingBox, getBoundingSphere, getFaceNormalsAsArray, getFaceNormalsAsArray, getFaces, getFacesAsArray, getIntersectionData, getMeshAsVertexArray, getMeshAsVertexArray, getNumFaces, getNumVertices, getUniqueVerticesAsArray, getVertexNormalsAsArray, getVertexNormalsAsArray, getVertices, intersectsRay, perforateFace, saveAsOBJ, saveAsOBJ, saveAsOBJ, saveAsSTL, saveAsSTL, saveAsSTL, saveAsSTL, saveAsSTL, saveAsSTL, setName, toWEMesh, updateVertex`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### edges

    public java.util.LinkedHashMap<Line3D,WingedEdge> edges

  WEVertex buffer & lookup index when adding new faces

Constructor Detail

### WETriangleMesh

    public WETriangleMesh()

### WETriangleMesh

    public WETriangleMesh(java.lang.String name)

  Creates a new mesh instance with initial default buffer sizes.

  Parameters:
    `name` - mesh name

### WETriangleMesh

    public WETriangleMesh(java.lang.String name,
                          int numV,
                          int numF)

  Creates a new mesh instance with the given initial buffer sizes. These numbers are no limits and the mesh can be smaller or grow later on. They're only used to initialise the underlying collections.

  Parameters:
    `name` - mesh name
    `numV` - initial vertex buffer size
    `numF` - initial face list size

Method Detail

### addFace

    public WETriangleMesh addFace(Vec3D a,
                                  Vec3D b,
                                  Vec3D c)

  Description copied from interface: `Mesh3D`
  Adds the given 3 points as triangle face to the mesh. The assumed vertex order is anti-clockwise.

  Specified by:
    `addFace` in interface `Mesh3D`
  Overrides:
    `addFace` in class `TriangleMesh`

### addFace

    public WETriangleMesh addFace(Vec3D a,
                                  Vec3D b,
                                  Vec3D c,
                                  Vec2D uvA,
                                  Vec2D uvB,
                                  Vec2D uvC)

  Description copied from interface: `Mesh3D`
  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.

  Specified by:
    `addFace` in interface `Mesh3D`
  Overrides:
    `addFace` in class `TriangleMesh`
  Returns:
    itself

### addFace

    public WETriangleMesh addFace(Vec3D a,
                                  Vec3D b,
                                  Vec3D c,
                                  Vec3D n)

  Specified by:
    `addFace` in interface `Mesh3D`
  Overrides:
    `addFace` in class `TriangleMesh`

### addFace

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

  Specified by:
    `addFace` in interface `Mesh3D`
  Overrides:
    `addFace` in class `TriangleMesh`

### addMesh

    public WETriangleMesh addMesh(Mesh3D m)

  Adds all faces from the given mesh to this one.

  Specified by:
    `addMesh` in interface `Mesh3D`
  Overrides:
    `addMesh` in class `TriangleMesh`
  Parameters:
    `m` - source mesh instance

### center

    public AABB center(ReadonlyVec3D origin)

  Description copied from interface: `Mesh3D`
  Centers the mesh around the given pivot point (the centroid of its AABB). Method also updates & returns the new bounding box.

  Specified by:
    `center` in interface `Mesh3D`
  Overrides:
    `center` in class `TriangleMesh`
  Parameters:
    `origin` - new centroid or null (defaults to {0,0,0})

### clear

    public WETriangleMesh clear()

  Clears all counters, and vertex & face buffers.

  Specified by:
    `clear` in interface `Mesh3D`
  Overrides:
    `clear` in class `TriangleMesh`

### copy

    public WETriangleMesh copy()

  Creates a deep clone of the mesh. The new mesh name will have "-copy" as suffix.

  Overrides:
    `copy` in class `TriangleMesh`
  Returns:
    new mesh instance

### flipVertexOrder

    public WETriangleMesh flipVertexOrder()

  Flips the vertex ordering between clockwise and anti-clockwise. WEFace normals are updated automatically too.

  Specified by:
    `flipVertexOrder` in interface `Mesh3D`
  Overrides:
    `flipVertexOrder` in class `TriangleMesh`
  Returns:
    itself

### flipYAxis

    public WETriangleMesh flipYAxis()

  Description copied from interface: `Mesh3D`
  Flips all vertices along the Y axis and reverses the vertex ordering of all faces to compensate and keep the direction of normals intact.

  Specified by:
    `flipYAxis` in interface `Mesh3D`
  Overrides:
    `flipYAxis` in class `TriangleMesh`
  Returns:
    itself

### getClosestVertexToPoint

    public WEVertex getClosestVertexToPoint(ReadonlyVec3D p)

  Specified by:
    `getClosestVertexToPoint` in interface `Mesh3D`
  Overrides:
    `getClosestVertexToPoint` in class `TriangleMesh`

### getRotatedAroundAxis

    public WETriangleMesh getRotatedAroundAxis(Vec3D axis,
                                               float theta)

  Overrides:
    `getRotatedAroundAxis` in class `TriangleMesh`

### getRotatedX

    public WETriangleMesh getRotatedX(float theta)

  Overrides:
    `getRotatedX` in class `TriangleMesh`

### getRotatedY

    public WETriangleMesh getRotatedY(float theta)

  Overrides:
    `getRotatedY` in class `TriangleMesh`

### getRotatedZ

    public WETriangleMesh getRotatedZ(float theta)

  Overrides:
    `getRotatedZ` in class `TriangleMesh`

### getScaled

    public WETriangleMesh getScaled(float scale)

  Overrides:
    `getScaled` in class `TriangleMesh`

### getScaled

    public WETriangleMesh getScaled(Vec3D scale)

  Overrides:
    `getScaled` in class `TriangleMesh`

### getTranslated

    public WETriangleMesh getTranslated(Vec3D trans)

  Overrides:
    `getTranslated` in class `TriangleMesh`

### getVertexAtPoint

    public WEVertex getVertexAtPoint(Vec3D v)

  Overrides:
    `getVertexAtPoint` in class `TriangleMesh`

### getVertexForID

    public WEVertex getVertexForID(int id)

  Overrides:
    `getVertexForID` in class `TriangleMesh`

### init

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

  Specified by:
    `init` in interface `Mesh3D`
  Overrides:
    `init` in class `TriangleMesh`

### pointTowards

    public WETriangleMesh pointTowards(ReadonlyVec3D dir)

  Rotates the mesh in such a way so that its "forward" axis is aligned with the given direction. This version uses the positive Z-axis as default forward direction.

  Overrides:
    `pointTowards` in class `TriangleMesh`
  Parameters:
    `dir` - new target direction to point in
  Returns:
    itself

### pointTowards

    public WETriangleMesh pointTowards(ReadonlyVec3D dir,
                                       ReadonlyVec3D forward)

  Rotates the mesh in such a way so that its "forward" axis is aligned with the given direction. This version allows to specify the forward direction.

  Overrides:
    `pointTowards` in class `TriangleMesh`
  Parameters:
    `dir` - new target direction to point in
    `forward` - current forward axis
  Returns:
    itself

### rebuildIndex

    public void rebuildIndex()

### removeFace

    public void removeFace(Face f)

  Overrides:
    `removeFace` in class `TriangleMesh`

### removeUnusedVertices

    public void removeUnusedVertices()

### removeVertices

    public void removeVertices(java.util.Collection<Vertex> selection)

### rotateAroundAxis

    public WETriangleMesh rotateAroundAxis(Vec3D axis,
                                           float theta)

  Overrides:
    `rotateAroundAxis` in class `TriangleMesh`

### rotateX

    public WETriangleMesh rotateX(float theta)

  Overrides:
    `rotateX` in class `TriangleMesh`

### rotateY

    public WETriangleMesh rotateY(float theta)

  Overrides:
    `rotateY` in class `TriangleMesh`

### rotateZ

    public WETriangleMesh rotateZ(float theta)

  Overrides:
    `rotateZ` in class `TriangleMesh`

### scale

    public WETriangleMesh scale(float scale)

  Overrides:
    `scale` in class `TriangleMesh`

### scale

    public WETriangleMesh scale(Vec3D scale)

  Overrides:
    `scale` in class `TriangleMesh`

### splitEdge

    public void splitEdge(ReadonlyVec3D a,
                          ReadonlyVec3D b,
                          SubdivisionStrategy subDiv)

### splitEdge

    public void splitEdge(WingedEdge e,
                          SubdivisionStrategy subDiv)

### subdivide

    public void subdivide()

### subdivide

    public void subdivide(float minLength)

### subdivide

    public void subdivide(SubdivisionStrategy subDiv)

### subdivide

    public void subdivide(SubdivisionStrategy subDiv,
                          float minLength)

### subdivideFaceEdges

    public void subdivideFaceEdges(java.util.List<WEFace> faces,
                                   SubdivisionStrategy subDiv,
                                   float minLength)

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `TriangleMesh`

### transform

    public WETriangleMesh transform(Matrix4x4 mat)

  Applies the given matrix transform to all mesh vertices and updates all face normals.

  Overrides:
    `transform` in class `TriangleMesh`
  Parameters:
    `mat` -
  Returns:
    itself

### transform

    public WETriangleMesh transform(Matrix4x4 mat,
                                    boolean updateNormals)

  Applies the given matrix transform to all mesh vertices. If the updateNormals flag is true, all face normals are updated automatically, however vertex normals still need a manual update.

  Overrides:
    `transform` in class `TriangleMesh`
  Parameters:
    `mat` -
    `updateNormals` -
  Returns:
    itself

### translate

    public WETriangleMesh translate(Vec3D trans)

  Overrides:
    `translate` in class `TriangleMesh`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD