artofillusion.object
Class CSGObject

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

public class CSGObject
extends Object3D

A CSGObject is an Object3D that represents the union, intersection, or difference of two component objects.


Nested Class Summary
static class CSGObject.CSGKeyframe
          Inner class representing a pose for a CSGObject.
 
Field Summary
static int DIFFERENCE12
           
static int DIFFERENCE21
           
static int INTERSECTION
           
static int UNION
           
 
Fields inherited from class artofillusion.object.Object3D
APPROXIMATELY, CANT_CONVERT, EXACTLY
 
Constructor Summary
CSGObject(java.io.DataInputStream in, Scene theScene)
           
CSGObject(ObjectInfo o1, ObjectInfo o2, int op)
           
 
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.
 Vec3 centerObjects()
          Center the component objects, and return the vector by which they were displaced.
 TriangleMesh convertToTriangleMesh(double tol)
          Create a triangle mesh representing 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.
 ObjectInfo getObject1()
          Get the first object.
 ObjectInfo getObject2()
          Get the second object.
 int getOperation()
          Get the boolean operation to be performed.
 Keyframe getPoseKeyframe()
          Return a Keyframe which describes the current pose of this object.
 RenderingMesh getRenderingMesh(double tol, boolean interactive, ObjectInfo info)
          Get a RenderingMesh for this object.
 WireframeMesh getWireframeMesh()
          Get a WireframeMesh for this object.
 boolean isClosed()
          This object is closed if both of its component objects are closed.
 boolean isEditable()
          Allow the user to edit this object.
 void setComponentObjects(ObjectInfo o1, ObjectInfo o2)
          Set the component objects.
 void setMaterial(Material mat, MaterialMapping mapping)
          Set the Material and MaterialMapping for this object.
 void setOperation(int op)
          Set the boolean operation to be performed.
 void setSize(double xsize, double ysize, double zsize)
          Resize the object.
 void setTexture(Texture tex, TextureMapping mapping)
          When setting the texture or material, also set it for each of the component objects.
 void writeToFile(java.io.DataOutputStream out, Scene theScene)
          Save this object to an output stream.
 
Methods inherited from class artofillusion.object.Object3D
canConvertToActor, canSetMaterial, canSetTexture, configurePoseTrack, copyTextureAndMaterial, editGesture, getAverageParameterValues, getMaterial, getMaterialMapping, getParameters, getParameterValue, getParameterValues, getPosableObject, getProperties, getPropertyValue, getSkeleton, getTexture, getTextureMapping, readParameterValue, renderObject, sceneChanged, setParameters, setParameterValue, setParameterValues, setPropertyValue
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNION

public static final int UNION
See Also:
Constant Field Values

INTERSECTION

public static final int INTERSECTION
See Also:
Constant Field Values

DIFFERENCE12

public static final int DIFFERENCE12
See Also:
Constant Field Values

DIFFERENCE21

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

CSGObject

public CSGObject(ObjectInfo o1,
                 ObjectInfo o2,
                 int op)

CSGObject

public CSGObject(java.io.DataInputStream in,
                 Scene theScene)
          throws java.io.IOException,
                 java.io.InvalidObjectException
Throws:
java.io.IOException
java.io.InvalidObjectException
Method Detail

duplicate

public Object3D duplicate()
Create a new object which is an exact duplicate of this one.

Specified by:
duplicate in class Object3D

copyObject

public void copyObject(Object3D obj)
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

getObject1

public ObjectInfo getObject1()
Get the first object.


getObject2

public ObjectInfo getObject2()
Get the second object.


getOperation

public int getOperation()
Get the boolean operation to be performed.


setOperation

public void setOperation(int op)
Set the boolean operation to be performed.


setComponentObjects

public void setComponentObjects(ObjectInfo o1,
                                ObjectInfo o2)
Set the component objects.


centerObjects

public Vec3 centerObjects()
Center the component objects, and return the vector by which they were displaced.


getBounds

public BoundingBox getBounds()
Get a BoundingBox which just encloses the object.

Specified by:
getBounds in class Object3D

setSize

public void setSize(double xsize,
                    double ysize,
                    double zsize)
Resize the object.

Specified by:
setSize in class Object3D

canConvertToTriangleMesh

public int canConvertToTriangleMesh()
Tells whether the object can be converted to a TriangleMesh.

Overrides:
canConvertToTriangleMesh in class Object3D

isClosed

public boolean isClosed()
This object is closed if both of its component objects are closed.

Overrides:
isClosed in class Object3D

convertToTriangleMesh

public TriangleMesh convertToTriangleMesh(double tol)
Create a triangle mesh representing this object.

Overrides:
convertToTriangleMesh in class Object3D

isEditable

public boolean isEditable()
Allow the user to edit this 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.

setTexture

public void setTexture(Texture tex,
                       TextureMapping mapping)
When setting the texture or material, also set it for each of the component objects.

Overrides:
setTexture in class Object3D

setMaterial

public void setMaterial(Material mat,
                        MaterialMapping mapping)
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

getRenderingMesh

public RenderingMesh getRenderingMesh(double tol,
                                      boolean interactive,
                                      ObjectInfo info)
Get a RenderingMesh for this object.

Overrides:
getRenderingMesh in class Object3D

getWireframeMesh

public WireframeMesh getWireframeMesh()
Get a WireframeMesh for this object.

Specified by:
getWireframeMesh in class Object3D

writeToFile

public void writeToFile(java.io.DataOutputStream out,
                        Scene theScene)
                 throws java.io.IOException
Save this object to an output stream.

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

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

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.