|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectartofillusion.object.Object3D
artofillusion.object.TriangleMesh
public class TriangleMesh
The TriangleMesh class represents an aritrary surface defined by a mesh of triangular faces. Depending on the selected smoothing method, the surface may simply consist of the triangular faces, or it may be a smooth subdivision surface which either interpolates or approximates the vertices of the control mesh.
Nested Class Summary | |
---|---|
class |
TriangleMesh.Edge
An edge is defined by the two vertices which it connects, and the two faces it is adjacent to. |
class |
TriangleMesh.Face
A face is defined by its three vertices and three edges. |
static class |
TriangleMesh.TriangleMeshKeyframe
This class represents a pose of a TriangleMesh. |
class |
TriangleMesh.Vertex
A vertex specifies a position vector, the number of edges which share the vertex, and the "first" edge. |
Field Summary |
---|
Fields inherited from class artofillusion.object.Object3D |
---|
APPROXIMATELY, CANT_CONVERT, EXACTLY |
Fields inherited from interface artofillusion.object.Mesh |
---|
APPROXIMATING, INTERPOLATING, NO_SMOOTHING, SMOOTH_SHADING |
Constructor Summary | |
---|---|
TriangleMesh(java.io.DataInputStream in,
Scene theScene)
The following two methods are used for reading and writing files. |
|
TriangleMesh(TriangleMesh.Vertex[] v,
int[][] faces)
|
|
TriangleMesh(Vec3[] v,
int[][] faces)
The constructor takes three arguments. |
Method Summary | |
---|---|
void |
applyPoseKeyframe(Keyframe k)
Modify this object based on a pose keyframe. |
void |
autosmoothMeshEdges(double angle)
Automatically select smoothness values for all edges in the mesh. |
boolean |
canConvertToActor()
Allow TriangleMeshes to be converted to Actors. |
int |
canConvertToTriangleMesh()
Tells whether the object can be converted to a TriangleMesh. |
TriangleMesh |
convertToTriangleMesh(double tol)
Get a more finely subdivided version of this mesh. |
void |
copyObject(Object3D obj)
Make this object exactly like another one. |
MeshViewer |
createMeshViewer(MeshEditController controller,
RowContainer options)
Get a MeshViewer which can be used for viewing this mesh. |
Object3D |
duplicate()
Create a duplicate of this object. |
void |
edit(EditingWindow parent,
ObjectInfo info,
java.lang.Runnable cb)
Display a window in which the user can edit this object. |
void |
editGesture(EditingWindow parent,
ObjectInfo info,
java.lang.Runnable cb,
ObjectInfo realObject)
Edit an object which represents a gesture for an Actor object. |
int[][] |
findBoundaryEdges()
Calculate a set of array representing the boundaries of this mesh. |
BoundingBox |
getBounds()
Get the bounding box for the mesh. |
TriangleMesh |
getDisplacedMesh(double tol,
double time)
Create a new triangle mesh by applying the displacement map of the texture assigned to this object. |
TriangleMesh.Edge[] |
getEdges()
|
int |
getFaceCount()
Get the number of faces in this mesh. |
TriangleMesh.Face[] |
getFaces()
|
int |
getFaceVertexCount(int faceIndex)
Get the number of vertices in a particular face. |
int |
getFaceVertexIndex(int faceIndex,
int vertexIndex)
Get the index of a particular vertex in a particular face. |
Vec3[] |
getNormals()
Get an array of normal vectors. |
Object3D |
getPosableObject()
TriangleMeshes cannot be keyframed directly, since any change to mesh topology would cause all keyframes to become invalid. |
Keyframe |
getPoseKeyframe()
Return a Keyframe which describes the current pose of this object. |
Property[] |
getProperties()
Get a list of editable properties defined by this object. |
java.lang.Object |
getPropertyValue(int index)
Get the value of one of this object's editable properties. |
RenderingMesh |
getRenderingMesh(double tol,
boolean interactive,
ObjectInfo info)
Objects which can be rendered as part of a scene should override this method to return a RenderingMesh which describes the appearance of the object. |
Skeleton |
getSkeleton()
Get the skeleton for this object. |
int |
getSmoothingMethod()
Get the smoothing method being used for this mesh. |
TriangleMesh.Vertex |
getVertex(int i)
|
Vec3[] |
getVertexPositions()
Get a list of the positions of all vertices which define the mesh. |
MeshVertex[] |
getVertices()
These methods return the lists of vertices, edges, and faces for the mesh. |
WireframeMesh |
getWireframeMesh()
Every object should override this method to return a WireframeMesh. |
boolean |
isClosed()
Tells whether the object is closed. |
boolean |
isEditable()
If the object can be edited by the user, isEditable() should be overridden to return true. |
void |
makeRightSideOut()
If necessary, reorder the points in each face so that the normals will be properly oriented. |
static TriangleMesh |
optimizeMesh(TriangleMesh mesh)
Return a new mesh which is an "optimized" version of the input mesh. |
void |
reverseNormals()
Reorder the vertices in each face, so as to reverse all of the normal vectors. |
void |
setMaterial(Material mat,
MaterialMapping map)
When setting the material, we need to clear the caches. |
void |
setParameterValue(TextureParameter param,
ParameterValue val)
When setting texture parameters, we need to clear the caches. |
void |
setParameterValues(ParameterValue[] val)
When setting texture parameters, we need to clear the caches. |
void |
setPropertyValue(int index,
java.lang.Object value)
Set the value of one of this object's editable properties. |
void |
setShape(TriangleMesh.Vertex[] v,
int[][] faces)
This method rebuilds the mesh based on new lists of vertices and faces. |
void |
setSize(double xsize,
double ysize,
double zsize)
Resize the object. |
void |
setSkeleton(Skeleton s)
Set the skeleton for this object. |
void |
setSmoothingMethod(int method)
Set the smoothing method. |
void |
setTexture(Texture tex,
TextureMapping mapping)
When setting the texture, we need to clear the caches. |
void |
setVertexPositions(Vec3[] v)
Set the positions for all the vertices of the mesh. |
static TriangleMesh |
subdivideButterfly(TriangleMesh mesh,
boolean[] refineEdge,
double tol)
This method subdivides the mesh using interpolating (modified Butterfly) subdivision, and returns a new TriangleMesh which approximates the limit surface to within the specified tolerance. |
static TriangleMesh |
subdivideEdges(TriangleMesh mesh,
boolean[] splitEdge,
double tol)
Subdivide all or part of the mesh using the mesh's defined smoothing method (linear, approximating, or interpolating). |
static TriangleMesh |
subdivideFaces(TriangleMesh mesh,
boolean[] split)
This method splits each selected face into three faces, and returns the subdivided mesh. |
static TriangleMesh |
subdivideLinear(TriangleMesh mesh,
boolean[] split)
This method subdivides each selected edge once, placing a new vertex in the midpoint of the edge, and returns the subdivided mesh. |
static TriangleMesh |
subdivideLoop(TriangleMesh mesh,
boolean[] refineEdge,
double tol)
This method subdivides the mesh using approximating (Loop) subdivision, and returns a new TriangleMesh which approximates the limit surface to within the specified tolerance. |
TriangleMesh |
subdivideToLimit(double tol)
Create a new triangle mesh by subdividing this one until no edge is longer than the specified tolerance. |
void |
writeToFile(java.io.DataOutputStream out,
Scene theScene)
The following method writes the object's data to an output stream. |
Methods inherited from class artofillusion.object.Object3D |
---|
canSetMaterial, canSetTexture, configurePoseTrack, copyTextureAndMaterial, editKeyframe, getAverageParameterValues, getMaterial, getMaterialMapping, getParameters, getParameterValue, getParameterValues, getTexture, getTextureMapping, readParameterValue, renderObject, sceneChanged, setParameters |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface artofillusion.object.Mesh |
---|
getParameters, getParameterValues |
Constructor Detail |
---|
public TriangleMesh(Vec3[] v, int[][] faces)
public TriangleMesh(TriangleMesh.Vertex[] v, int[][] faces)
public TriangleMesh(java.io.DataInputStream in, Scene theScene) throws java.io.IOException, java.io.InvalidObjectException
java.io.IOException
java.io.InvalidObjectException
Method Detail |
---|
public Object3D duplicate()
duplicate
in interface Mesh
duplicate
in class Object3D
public void copyObject(Object3D obj)
copyObject
in interface Mesh
copyObject
in class Object3D
public BoundingBox getBounds()
getBounds
in interface Mesh
getBounds
in class Object3D
public MeshVertex[] getVertices()
getVertices
in interface Mesh
public TriangleMesh.Vertex getVertex(int i)
public TriangleMesh.Edge[] getEdges()
public TriangleMesh.Face[] getFaces()
public int getSmoothingMethod()
public Vec3[] getVertexPositions()
getVertexPositions
in interface Mesh
public void setVertexPositions(Vec3[] v)
setVertexPositions
in interface Mesh
public void setSmoothingMethod(int method)
public void setShape(TriangleMesh.Vertex[] v, int[][] faces)
public boolean isClosed()
Object3D
isClosed
in class Object3D
public void setSize(double xsize, double ysize, double zsize)
Object3D
setSize
in class Object3D
public int[][] findBoundaryEdges()
public boolean isEditable()
Object3D
isEditable
in class Object3D
public void edit(EditingWindow parent, ObjectInfo info, java.lang.Runnable cb)
Object3D
edit
in class Object3D
parent
- the window from which this command is being invokedinfo
- the ObjectInfo corresponding to this objectcb
- a callback which will be executed when editing is complete. If the user
cancels the operation, it will not be called.public void editGesture(EditingWindow parent, ObjectInfo info, java.lang.Runnable cb, ObjectInfo realObject)
Object3D
editGesture
in class Object3D
public MeshViewer createMeshViewer(MeshEditController controller, RowContainer options)
createMeshViewer
in interface Mesh
public int canConvertToTriangleMesh()
Object3D
canConvertToTriangleMesh
in class Object3D
public TriangleMesh convertToTriangleMesh(double tol)
convertToTriangleMesh
in class Object3D
public WireframeMesh getWireframeMesh()
Object3D
getWireframeMesh
in class Object3D
public RenderingMesh getRenderingMesh(double tol, boolean interactive, ObjectInfo info)
Object3D
The ObjectInfo contains additional information which may affect how the object is rendered, such as it location in the scene, texture parameters, etc.
Objects which cannot be rendered directly (lights, cameras, curves, etc.) do not need to override this method.
getRenderingMesh
in class Object3D
public void setTexture(Texture tex, TextureMapping mapping)
setTexture
in class Object3D
public void setMaterial(Material mat, MaterialMapping map)
setMaterial
in class Object3D
public void setParameterValues(ParameterValue[] val)
setParameterValues
in class Object3D
public void setParameterValue(TextureParameter param, ParameterValue val)
setParameterValue
in class Object3D
public Skeleton getSkeleton()
getSkeleton
in interface Mesh
getSkeleton
in class Object3D
public void setSkeleton(Skeleton s)
setSkeleton
in interface Mesh
public static TriangleMesh subdivideEdges(TriangleMesh mesh, boolean[] splitEdge, double tol)
mesh
- the mesh to subdividesplitEdge
- a flag for each edge, specifying which ones should be split. If this is null,
every edge will be split.tol
- the error tolerance. Edges will be repeatedly subdivided until every point on the
subdivided mesh is within this distance of the limit surface. If this is equal to
Double.MAX_VALUE, each edge will be subdivided exactly once.
public static TriangleMesh subdivideLinear(TriangleMesh mesh, boolean[] split)
mesh
- the mesh to subdividesplit
- a flag for each edge, specifying which ones should be split. If this is null,
every edge will be split.
public static TriangleMesh subdivideLoop(TriangleMesh mesh, boolean[] refineEdge, double tol)
mesh
- the mesh to subdividerefineEdge
- a flag for each edge, specifying which ones should be split. If this is null,
every edge will be split.tol
- the error tolerance. Edges will be repeatedly subdivided until every point on the
subdivided mesh is within this distance of the limit surface. If this is equal to
Double.MAX_VALUE, each edge will be subdivided exactly once.
public static TriangleMesh subdivideButterfly(TriangleMesh mesh, boolean[] refineEdge, double tol)
mesh
- the mesh to subdividerefineEdge
- a flag for each edge, specifying which ones should be split. If this is null,
every edge will be split.tol
- the error tolerance. Edges will be repeatedly subdivided until every point on the
subdivided mesh is within this distance of the limit surface. If this is equal to
Double.MAX_VALUE, each edge will be subdivided exactly once.
public static TriangleMesh subdivideFaces(TriangleMesh mesh, boolean[] split)
public TriangleMesh subdivideToLimit(double tol)
public TriangleMesh getDisplacedMesh(double tol, double time)
public void makeRightSideOut()
public void reverseNormals()
public Vec3[] getNormals()
getNormals
in interface Mesh
public int getFaceCount()
FacetedMesh
getFaceCount
in interface FacetedMesh
public int getFaceVertexCount(int faceIndex)
FacetedMesh
getFaceVertexCount
in interface FacetedMesh
faceIndex
- the index of the facepublic int getFaceVertexIndex(int faceIndex, int vertexIndex)
FacetedMesh
getFaceVertexIndex
in interface FacetedMesh
faceIndex
- the index of the facevertexIndex
- the index of the vertex within the face
(between 0 and getFaceVertexCount(face)-1 inclusive)
public static TriangleMesh optimizeMesh(TriangleMesh mesh)
public void autosmoothMeshEdges(double angle)
angle
- the cutoff angle, in radianspublic void writeToFile(java.io.DataOutputStream out, Scene theScene) throws java.io.IOException
Object3D
writeToFile
in class Object3D
java.io.IOException
public Property[] getProperties()
Object3D
getProperties
in class Object3D
public java.lang.Object getPropertyValue(int index)
Object3D
getPropertyValue
in class Object3D
index
- the index of the property to getpublic void setPropertyValue(int index, java.lang.Object value)
Object3D
setPropertyValue
in class Object3D
index
- the index of the property to setvalue
- the value to set for the propertypublic Keyframe getPoseKeyframe()
getPoseKeyframe
in class Object3D
public void applyPoseKeyframe(Keyframe k)
applyPoseKeyframe
in class Object3D
public boolean canConvertToActor()
canConvertToActor
in class Object3D
public Object3D getPosableObject()
getPosableObject
in class Object3D
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |