artofillusion.object
Class Tube

java.lang.Object
  extended by artofillusion.object.Object3D
      extended by artofillusion.object.Curve
          extended by artofillusion.object.Tube
All Implemented Interfaces:
Mesh

public class Tube
extends Curve

Tube represents a "thick" curve. It subclasses Curve, since it has all the properties of a an ordinary curve, but changes the way it is rendered. The actual surface is created by extruding a circular profile along the curve. The thickness of the Tube can be specified at each vertex.


Nested Class Summary
static class Tube.TubeKeyframe
          This class represents a pose of a Tube.
 
Nested classes/interfaces inherited from class artofillusion.object.Curve
Curve.CurveKeyframe
 
Field Summary
static int CLOSED_ENDS
           
static int FLAT_ENDS
           
static int OPEN_ENDS
           
 
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
Tube(Curve c, double[] thickness, int endsStyle)
          Create a tube based on a Curve.
Tube(java.io.DataInputStream in, Scene theScene)
          The following two methods are used for reading and writing files.
Tube(MeshVertex[] v, float[] smoothness, double[] thickness, int smoothingMethod, int endsStyle)
          Create a tube, explicitly specifying all parameters.
Tube(Vec3[] v, double thickness, int smoothingMethod, int endsStyle)
          Create a tube with uniform thickness and a smoothness of 1 at all vertices.
Tube(Vec3[] v, float[] smoothness, double[] thickness, int smoothingMethod, int endsStyle)
          Create a tube, explicitly specifying all parameters.
 
Method Summary
 void applyPoseKeyframe(Keyframe k)
          Modify this object based on a pose keyframe.
static double calcApproxThickness(double[] t, float[] s, int i, int j, int k)
           
static double calcInterpThickness(double[] t, float[] s, int i, int j, int k, int m)
           
 boolean canConvertToActor()
          Determine whether the user should be allowed to convert this object to an Actor.
 int canConvertToTriangleMesh()
          Tells whether the object can be converted to a TriangleMesh.
 boolean canSetTexture()
          This method tells whether textures can be assigned to the object.
 TriangleMesh convertToTriangleMesh(double tol)
          Get a triangle mesh which approximates the surface of this object at the specified accuracy.
 void copyObject(Object3D obj)
          Make this object identical to another one.
 MeshViewer createMeshViewer(MeshEditController controller, RowContainer options)
          Get a MeshViewer which can be used for viewing this mesh.
 Object3D duplicate()
          Create an exact 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 getEndsStyle()
          Get the ends style.
 Object3D getPosableObject()
          Tubes 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)
          Get a rendering mesh representing the surface of this object at the specified accuracy.
 double[] getThickness()
          Get the thickness of the tube at each vertex.
 WireframeMesh getWireframeMesh()
          Get a wireframe mesh representing the surface of this object at the specified accuracy.
 boolean isClosed()
          Determine whether this tube is a closed surface.
 void setClosed(boolean isClosed)
          Make sure the ends style is consistent with the closed flag.
 void setEndsStyle(int style)
          Set the ends style.
 void setMaterial(Material mat, MaterialMapping map)
          When setting the material, we need to clear the cached meshes.
 void setPropertyValue(int index, java.lang.Object value)
          Set the value of one of this object's editable properties.
 void setShape(MeshVertex[] v, float[] smoothness, double[] thickness)
          Set the position, smoothness, and thickness values for all points.
 void setTexture(Texture tex, TextureMapping mapping)
          When setting the texture, we need to clear the cached meshes.
 void setThickness(double[] thickness)
          Set the thickness of the tube at each vertex.
 Tube subdivideTube(double tol)
          Subdivide the curve which defines this tube to 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.Curve
calcApproxPoint, calcInterpPoint, getBounds, getNormals, getSkeleton, getSmoothingMethod, getSmoothness, getVertexPositions, getVertices, isEditable, movePoint, setShape, setSize, setSkeleton, setSmoothingMethod, setSmoothness, setVertexPositions, subdivideCurve, subdivideCurve
 
Methods inherited from class artofillusion.object.Object3D
canSetMaterial, configurePoseTrack, copyTextureAndMaterial, editKeyframe, getAverageParameterValues, getMaterial, getMaterialMapping, getParameters, getParameterValue, getParameterValues, getTexture, getTextureMapping, readParameterValue, renderObject, sceneChanged, setParameters, setParameterValue, setParameterValues
 
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
 

Field Detail

OPEN_ENDS

public static final int OPEN_ENDS
See Also:
Constant Field Values

CLOSED_ENDS

public static final int CLOSED_ENDS
See Also:
Constant Field Values

FLAT_ENDS

public static final int FLAT_ENDS
See Also:
Constant Field Values
Constructor Detail

Tube

public Tube(Vec3[] v,
            float[] smoothness,
            double[] thickness,
            int smoothingMethod,
            int endsStyle)
Create a tube, explicitly specifying all parameters.


Tube

public Tube(MeshVertex[] v,
            float[] smoothness,
            double[] thickness,
            int smoothingMethod,
            int endsStyle)
Create a tube, explicitly specifying all parameters.


Tube

public Tube(Curve c,
            double[] thickness,
            int endsStyle)
Create a tube based on a Curve.


Tube

public Tube(Vec3[] v,
            double thickness,
            int smoothingMethod,
            int endsStyle)
Create a tube with uniform thickness and a smoothness of 1 at all vertices.


Tube

public Tube(java.io.DataInputStream in,
            Scene theScene)
     throws java.io.IOException,
            java.io.InvalidObjectException
The following two methods are used for reading and writing files. The first is a constructor which reads the necessary data from an input stream. The other writes the object's representation to an output stream.

Throws:
java.io.IOException
java.io.InvalidObjectException
Method Detail

duplicate

public Object3D duplicate()
Create an exact duplicate of this object.

Specified by:
duplicate in interface Mesh
Overrides:
duplicate in class Curve

copyObject

public void copyObject(Object3D obj)
Make this object identical to another one.

Specified by:
copyObject in interface Mesh
Overrides:
copyObject in class Curve

getThickness

public double[] getThickness()
Get the thickness of the tube at each vertex.


setThickness

public void setThickness(double[] thickness)
Set the thickness of the tube at each vertex.


setShape

public void setShape(MeshVertex[] v,
                     float[] smoothness,
                     double[] thickness)
Set the position, smoothness, and thickness values for all points.


getEndsStyle

public int getEndsStyle()
Get the ends style.


setEndsStyle

public void setEndsStyle(int style)
Set the ends style. This should be one of the following values: OPEN_ENDS, CLOSED_ENDS, or FLAT_ENDS.


isClosed

public boolean isClosed()
Determine whether this tube is a closed surface.

Overrides:
isClosed in class Curve

setClosed

public void setClosed(boolean isClosed)
Make sure the ends style is consistent with the closed flag. Generally, setEndsStyle() should be used instead of this method.

Overrides:
setClosed in class Curve

subdivideTube

public Tube subdivideTube(double tol)
Subdivide the curve which defines this tube to the specified tolerance.


calcInterpThickness

public static double calcInterpThickness(double[] t,
                                         float[] s,
                                         int i,
                                         int j,
                                         int k,
                                         int m)

calcApproxThickness

public static double calcApproxThickness(double[] t,
                                         float[] s,
                                         int i,
                                         int j,
                                         int k)

canSetTexture

public boolean canSetTexture()
Description copied from class: Object3D
This method tells whether textures can be assigned to the object. Objects for which it makes no sense to assign a texture (curves, lights, etc.) should override this method to return false.

Overrides:
canSetTexture in class Curve

canConvertToTriangleMesh

public int canConvertToTriangleMesh()
Description copied from class: Object3D
Tells whether the object can be converted to a TriangleMesh. It should return one of the following values: CANT_CONVERT: The object cannot be converted to a TriangleMesh. EXACTLY: The object can be represented exactly by a TriangleMesh. APPROXIMATELY: The object can be converted to a TriangleMesh. However, the resulting mesh will not be exactly the same shape as the original object. If a class overrides this method, it must also override convertToTriangleMesh().

Overrides:
canConvertToTriangleMesh in class Curve

getRenderingMesh

public RenderingMesh getRenderingMesh(double tol,
                                      boolean interactive,
                                      ObjectInfo info)
Get a rendering mesh representing the surface of this object at the specified accuracy.

Overrides:
getRenderingMesh in class Object3D

setTexture

public void setTexture(Texture tex,
                       TextureMapping mapping)
When setting the texture, we need to clear the cached meshes.

Overrides:
setTexture in class Object3D

setMaterial

public void setMaterial(Material mat,
                        MaterialMapping map)
When setting the material, we need to clear the cached meshes.

Overrides:
setMaterial in class Object3D

getWireframeMesh

public WireframeMesh getWireframeMesh()
Get a wireframe mesh representing the surface of this object at the specified accuracy.

Overrides:
getWireframeMesh in class Curve

convertToTriangleMesh

public TriangleMesh convertToTriangleMesh(double tol)
Get a triangle mesh which approximates the surface of this object at the specified accuracy.

Overrides:
convertToTriangleMesh in class Curve

edit

public void edit(EditingWindow parent,
                 ObjectInfo info,
                 java.lang.Runnable cb)
Description copied from class: Object3D
Display a window in which the user can edit this object.

Overrides:
edit in class Curve
Parameters:
parent - the window from which this command is being invoked
info - the ObjectInfo corresponding to this object
cb - a callback which will be executed when editing is complete. If the user cancels the operation, it will not be called.

editGesture

public void editGesture(EditingWindow parent,
                        ObjectInfo info,
                        java.lang.Runnable cb,
                        ObjectInfo realObject)
Description copied from class: Object3D
Edit an object which represents a gesture for an Actor object. realObject specifies the object in the scene which this is a gesture for.

Overrides:
editGesture in class Curve

createMeshViewer

public MeshViewer createMeshViewer(MeshEditController controller,
                                   RowContainer options)
Get a MeshViewer which can be used for viewing this mesh.

Specified by:
createMeshViewer in interface Mesh
Overrides:
createMeshViewer in class Curve

writeToFile

public void writeToFile(java.io.DataOutputStream out,
                        Scene theScene)
                 throws java.io.IOException
Description copied from class: Object3D
The following method writes the object's data to an output stream. Subclasses should override this method, but also call super.writeToFile() to save information about materials, etc. In addition to this method, every Object3D must include a constructor with the signature public Classname(DataInputStream in, Scene theScene) throws IOException, InvalidObjectException which reconstructs the object by reading its data from an input stream. This constructor, similarly, should call the overridden constructor to read information about materials, etc.

Overrides:
writeToFile in class Curve
Throws:
java.io.IOException

getProperties

public Property[] getProperties()
Description copied from class: Object3D
Get a list of editable properties defined by this object.

Overrides:
getProperties in class Curve

getPropertyValue

public java.lang.Object getPropertyValue(int index)
Description copied from class: Object3D
Get the value of one of this object's editable properties.

Overrides:
getPropertyValue in class Curve
Parameters:
index - the index of the property to get

setPropertyValue

public void setPropertyValue(int index,
                             java.lang.Object value)
Description copied from class: Object3D
Set the value of one of this object's editable properties.

Overrides:
setPropertyValue in class Curve
Parameters:
index - the index of the property to set
value - the value to set for the property

getPoseKeyframe

public Keyframe getPoseKeyframe()
Return a Keyframe which describes the current pose of this object.

Overrides:
getPoseKeyframe in class Curve

applyPoseKeyframe

public void applyPoseKeyframe(Keyframe k)
Modify this object based on a pose keyframe.

Overrides:
applyPoseKeyframe in class Curve

canConvertToActor

public boolean canConvertToActor()
Description copied from class: Object3D
Determine whether the user should be allowed to convert this object to an Actor.

Overrides:
canConvertToActor in class Curve

getPosableObject

public Object3D getPosableObject()
Tubes cannot be keyframed directly, since any change to mesh topology would cause all keyframes to become invalid. Return an actor for this mesh.

Overrides:
getPosableObject in class Curve


Copyright © 1999-2011 by Peter Eastman.