artofillusion.object
Class Cylinder

java.lang.Object
  extended by artofillusion.object.Object3D
      extended by artofillusion.object.Cylinder

public class Cylinder
extends Object3D

The Cylinder class represents cylinders and cones. It is specified by the height, the radii along the two axes of its base, and the ratio of the top and bottom radii.


Nested Class Summary
static class Cylinder.CylinderKeyframe
          Inner class representing a pose for a cylinder.
 
Field Summary
 
Fields inherited from class artofillusion.object.Object3D
APPROXIMATELY, CANT_CONVERT, EXACTLY
 
Constructor Summary
Cylinder(java.io.DataInputStream in, Scene theScene)
          The following two methods are used for reading and writing files.
Cylinder(double height, double xradius, double yradius, double ratio)
           
 
Method Summary
 void applyPoseKeyframe(Keyframe k)
          Modify this object based on a pose keyframe.
 int canConvertToTriangleMesh()
          Tells whether the object can be converted to a TriangleMesh.
 void configurePoseTrack(PoseTrack track)
          This will be called whenever a new pose track is created for this object.
 TriangleMesh convertToTriangleMesh(double tol)
          Return a TriangleMesh which reproduces the shape of this object.
 void copyObject(Object3D obj)
          Copy all the properties of another object, to make this one identical to it.
 Object3D duplicate()
          Create a new object which is an exact duplicate of this one.
 void edit(EditingWindow parent, ObjectInfo info, java.lang.Runnable cb)
          Display a window in which the user can edit this object.
 void editKeyframe(EditingWindow parent, Keyframe k, ObjectInfo info)
          Allow the user to edit a keyframe returned by getPoseKeyframe().
 BoundingBox getBounds()
          Get a BoundingBox which just encloses the object.
 double[] getDefaultPoseValues()
          Get the default list of graphable values for a keyframe returned by getPoseKeyframe().
 Keyframe getPoseKeyframe()
          Return a Keyframe which describes the current pose of this object.
 java.lang.String[] getPoseValueNames()
          Return an array containing the names of the graphable values for the keyframes returned by getPoseKeyframe().
 double[][] getPoseValueRange()
          Get the allowed range for graphable values for keyframes returned by getPoseKeyframe().
 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.
 double getRatio()
          Get the ratio of top/bottom radius.
 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.
 WireframeMesh getWireframeMesh()
          Every object should override this method to return a WireframeMesh.
 boolean isEditable()
          If the object can be edited by the user, isEditable() should be overridden to return true.
 void setMaterial(Material mat, MaterialMapping map)
          Set the Material and MaterialMapping for this object.
 void setPropertyValue(int index, java.lang.Object value)
          Set the value of one of this object's editable properties.
 void setRatio(double ratio)
          Set the ratio of top/bottom radius.
 void setSize(double xsize, double ysize, double zsize)
          Resize the object.
 void setTexture(Texture tex, TextureMapping mapping)
          Set the Texture and TextureMapping for this object.
 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
canConvertToActor, canSetMaterial, canSetTexture, copyTextureAndMaterial, editGesture, getAverageParameterValues, getMaterial, getMaterialMapping, getParameters, getParameterValue, getParameterValues, getPosableObject, getSkeleton, getTexture, getTextureMapping, isClosed, readParameterValue, renderObject, sceneChanged, setParameters, setParameterValue, setParameterValues
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Cylinder

public Cylinder(double height,
                double xradius,
                double yradius,
                double ratio)

Cylinder

public Cylinder(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()
Description copied from class: Object3D
Create a new object which is an exact duplicate of this one.

Specified by:
duplicate in class Object3D

copyObject

public void copyObject(Object3D obj)
Description copied from class: Object3D
Copy all the properties of another object, to make this one identical to it. If the two objects are of different classes, this will throw a ClassCastException.

Specified by:
copyObject in class Object3D

getRatio

public double getRatio()
Get the ratio of top/bottom radius.


setRatio

public void setRatio(double ratio)
Set the ratio of top/bottom radius.


getBounds

public BoundingBox getBounds()
Description copied from class: Object3D
Get a BoundingBox which just encloses the object.

Specified by:
getBounds in class Object3D

setSize

public void setSize(double xsize,
                    double ysize,
                    double zsize)
Description copied from class: Object3D
Resize the object. This should be interpreted such that, if setSize() is followed by a call to getBounds(), the dimensions of the BoundingBox will exactly match the dimensions specified in setSize().

Specified by:
setSize in class Object3D

getWireframeMesh

public WireframeMesh getWireframeMesh()
Description copied from class: Object3D
Every object should override this method to return a WireframeMesh. This will be used for drawing the object in wireframe mode, and also for drawing "nonrenderable" objects in other rendering modes.

Specified by:
getWireframeMesh in class Object3D

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 Object3D

convertToTriangleMesh

public TriangleMesh convertToTriangleMesh(double tol)
Description copied from class: Object3D
Return a TriangleMesh which reproduces the shape of this object. If canConvertToTriangleMesh() returned APPROXIMATELY, this method should return a TriangleMesh which reproduces the object to within the specified tolerance. That is, no point on the mesh should be further than tol from the corresponding point on the original surface. If canConvertToTriangleMesh() returned EXACTLY, then tol should be ignored. If canConvertToTriangleMesh() return CANT_CONVERT, this method returns null.

Overrides:
convertToTriangleMesh in class Object3D

getRenderingMesh

public RenderingMesh getRenderingMesh(double tol,
                                      boolean interactive,
                                      ObjectInfo info)
Description copied from class: Object3D
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. All points on the RenderingMesh should be within a distance tol of the true surface. The interactive flag tells whether the resulting Mesh will be rendered in interactive mode. When interactive is set to true, the RenderingMesh should be cached for future use, so that it may be rendered repeatedly without needing to be regenerated.

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.

Overrides:
getRenderingMesh in class Object3D

setTexture

public void setTexture(Texture tex,
                       TextureMapping mapping)
Description copied from class: Object3D
Set the Texture and TextureMapping for this object.

Overrides:
setTexture in class Object3D

setMaterial

public void setMaterial(Material mat,
                        MaterialMapping map)
Description copied from class: Object3D
Set the Material and MaterialMapping for this object. Pass null for both arguments to specify that the object does not have a Material.

Overrides:
setMaterial in class Object3D

isEditable

public boolean isEditable()
Description copied from class: Object3D
If the object can be edited by the user, isEditable() should be overridden to return true. edit() should then create a window and allow the user to edit the object.

Overrides:
isEditable in class Object3D

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 Object3D
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.

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 Object3D
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 Object3D

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 Object3D
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 Object3D
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.

Specified by:
getPoseKeyframe in class Object3D

applyPoseKeyframe

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

Specified by:
applyPoseKeyframe in class Object3D

configurePoseTrack

public void configurePoseTrack(PoseTrack track)
This will be called whenever a new pose track is created for this object. It allows the object to configure the track by setting its graphable values, subtracks, etc.

Overrides:
configurePoseTrack in class Object3D

getPoseValueNames

public java.lang.String[] getPoseValueNames()
Return an array containing the names of the graphable values for the keyframes returned by getPoseKeyframe().


getDefaultPoseValues

public double[] getDefaultPoseValues()
Get the default list of graphable values for a keyframe returned by getPoseKeyframe().


getPoseValueRange

public double[][] getPoseValueRange()
Get the allowed range for graphable values for keyframes returned by getPoseKeyframe(). This returns a 2D array, where elements [n][0] and [n][1] are the minimum and maximum allowed values, respectively, for the nth graphable value.


editKeyframe

public void editKeyframe(EditingWindow parent,
                         Keyframe k,
                         ObjectInfo info)
Allow the user to edit a keyframe returned by getPoseKeyframe().

Overrides:
editKeyframe in class Object3D


Copyright © 1999-2011 by Peter Eastman.