|
||||||||||
| 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,
buoy.widget.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. |
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 |
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, setMaterial, 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 Meshduplicate in class Object3Dpublic void copyObject(Object3D obj)
copyObject in interface MeshcopyObject in class Object3Dpublic BoundingBox getBounds()
getBounds in interface MeshgetBounds in class Object3Dpublic MeshVertex[] getVertices()
getVertices in interface Meshpublic TriangleMesh.Edge[] getEdges()
public TriangleMesh.Face[] getFaces()
public int getSmoothingMethod()
public Vec3[] getVertexPositions()
getVertexPositions in interface Meshpublic void setVertexPositions(Vec3[] v)
setVertexPositions in interface Meshpublic 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 Object3Dpublic 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 Object3Dparent - 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,
buoy.widget.RowContainer options)
createMeshViewer in interface Meshpublic int canConvertToTriangleMesh()
Object3D
canConvertToTriangleMesh in class Object3Dpublic TriangleMesh convertToTriangleMesh(double tol)
convertToTriangleMesh in class Object3Dpublic WireframeMesh getWireframeMesh()
Object3D
getWireframeMesh in class Object3D
public RenderingMesh getRenderingMesh(double tol,
boolean interactive,
ObjectInfo info)
Object3DThe 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 Object3Dpublic void setParameterValues(ParameterValue[] val)
setParameterValues in class Object3D
public void setParameterValue(TextureParameter param,
ParameterValue val)
setParameterValue in class Object3Dpublic Skeleton getSkeleton()
getSkeleton in interface MeshgetSkeleton in class Object3Dpublic 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 Meshpublic int getFaceCount()
FacetedMesh
getFaceCount in interface FacetedMeshpublic int getFaceVertexCount(int faceIndex)
FacetedMesh
getFaceVertexCount in interface FacetedMeshfaceIndex - the index of the face
public int getFaceVertexIndex(int faceIndex,
int vertexIndex)
FacetedMesh
getFaceVertexIndex in interface FacetedMeshfaceIndex - 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 radians
public void writeToFile(java.io.DataOutputStream out,
Scene theScene)
throws java.io.IOException
Object3D
writeToFile in class Object3Djava.io.IOExceptionpublic Property[] getProperties()
Object3D
getProperties in class Object3Dpublic java.lang.Object getPropertyValue(int index)
Object3D
getPropertyValue in class Object3Dindex - the index of the property to get
public void setPropertyValue(int index,
java.lang.Object value)
Object3D
setPropertyValue in class Object3Dindex - the index of the property to setvalue - the value to set for the propertypublic Keyframe getPoseKeyframe()
getPoseKeyframe in class Object3Dpublic void applyPoseKeyframe(Keyframe k)
applyPoseKeyframe in class Object3Dpublic boolean canConvertToActor()
canConvertToActor in class Object3Dpublic Object3D getPosableObject()
getPosableObject in class Object3D
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||