unbboolean.solids
Class CompoundSolid

java.lang.Object
  |
  +--javax.media.j3d.SceneGraphObject
        |
        +--javax.media.j3d.Node
              |
              +--javax.media.j3d.Leaf
                    |
                    +--javax.media.j3d.Shape3D
                          |
                          +--unbboolean.bool.Solid
                                |
                                +--unbboolean.solids.CSGSolid
                                      |
                                      +--unbboolean.solids.CompoundSolid

public class CompoundSolid
extends CSGSolid

Class representing a compound solid

Author:
Danilo Balby Silva Castanheira(danbalby@yahoo.com)

Field Summary
static int DIFFERENCE
          difference operation
static int INTERSECTION
          intersection operation
static int UNION
          union operation
 
Fields inherited from class javax.media.j3d.Shape3D
ALLOW_APPEARANCE_OVERRIDE_READ, ALLOW_APPEARANCE_OVERRIDE_WRITE, ALLOW_APPEARANCE_READ, ALLOW_APPEARANCE_WRITE, ALLOW_COLLISION_BOUNDS_READ, ALLOW_COLLISION_BOUNDS_WRITE, ALLOW_GEOMETRY_READ, ALLOW_GEOMETRY_WRITE
 
Fields inherited from class javax.media.j3d.Node
ALLOW_AUTO_COMPUTE_BOUNDS_READ, ALLOW_AUTO_COMPUTE_BOUNDS_WRITE, ALLOW_BOUNDS_READ, ALLOW_BOUNDS_WRITE, ALLOW_COLLIDABLE_READ, ALLOW_COLLIDABLE_WRITE, ALLOW_LOCAL_TO_VWORLD_READ, ALLOW_PICKABLE_READ, ALLOW_PICKABLE_WRITE, ENABLE_COLLISION_REPORTING, ENABLE_PICK_REPORTING
 
Constructor Summary
CompoundSolid(java.lang.String name, int operation, CSGSolid operator1, CSGSolid operator2)
          Constructs a customized CompoundSolid object
 
Method Summary
 CSGSolid copy()
          Copies the solid
 int getOperation()
          Gets the operation
 CSGSolid getOperator1()
          Gets the first operator
 CSGSolid getOperator2()
          Gets the second operator
 void setOperation(int operation)
          Sets the operation
 void setOperationToInverseDifference()
          Sets the operation to inverse difference (invert the operators and apply difference)
 void setOperator1(CSGSolid solid)
          Sets the first operator
 void setOperator2(CSGSolid solid)
          Sets the second operator
 java.lang.String toString()
          String representation of a compound solid (to be used on the CSG Tree)
 void updateChildren()
          Updates all its descendants (called after some transforms were performed)
 void updateItselfAndParents()
          Update itself and parents (called when coordinates were changed)
 
Methods inherited from class unbboolean.solids.CSGSolid
getLocation, getName, getParentSolid, isLighted, light, rotate, setName, setParentSolid, translate, unlight, updateLocation, updateParents, zoom
 
Methods inherited from class unbboolean.bool.Solid
getColors, getIndices, getVertices, isEmpty, scale, setColor, setData
 
Methods inherited from class javax.media.j3d.Shape3D
addGeometry, cloneNode, duplicateNode, getAllGeometries, getAppearance, getAppearanceOverrideEnable, getBounds, getCollisionBounds, getGeometry, getGeometry, indexOfGeometry, insertGeometry, intersect, intersect, intersect, numGeometries, removeAllGeometries, removeGeometry, removeGeometry, setAppearance, setAppearanceOverrideEnable, setCollisionBounds, setGeometry, setGeometry
 
Methods inherited from class javax.media.j3d.Node
cloneTree, cloneTree, cloneTree, cloneTree, cloneTree, cloneTree, getBoundsAutoCompute, getCollidable, getLocalToVworld, getLocalToVworld, getParent, getPickable, setBounds, setBoundsAutoCompute, setCollidable, setPickable
 
Methods inherited from class javax.media.j3d.SceneGraphObject
clearCapability, clearCapabilityIsFrequent, getCapability, getCapabilityIsFrequent, getUserData, isCompiled, isLive, setCapability, setCapabilityIsFrequent, setUserData, updateNodeReferences
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

UNION

public static final int UNION
union operation

See Also:
Constant Field Values

INTERSECTION

public static final int INTERSECTION
intersection operation

See Also:
Constant Field Values

DIFFERENCE

public static final int DIFFERENCE
difference operation

See Also:
Constant Field Values
Constructor Detail

CompoundSolid

public CompoundSolid(java.lang.String name,
                     int operation,
                     CSGSolid operator1,
                     CSGSolid operator2)
              throws InvalidBooleanOperationException
Constructs a customized CompoundSolid object

Parameters:
name - solid name
operation - operation applied onto the operators - UNION, INTERSECTION or DIFFERENCE
operator1 - first operator
operator2 - second operator
Throws:
InvalidBooleanOperationException - if a boolean operation generates an empty solid
Method Detail

toString

public java.lang.String toString()
String representation of a compound solid (to be used on the CSG Tree)

Overrides:
toString in class java.lang.Object
Returns:
string representation

getOperation

public int getOperation()
Gets the operation

Returns:
operation

getOperator1

public CSGSolid getOperator1()
Gets the first operator

Returns:
first operator

getOperator2

public CSGSolid getOperator2()
Gets the second operator

Returns:
second operator

setOperation

public void setOperation(int operation)
                  throws InvalidBooleanOperationException
Sets the operation

Parameters:
operation - operation
Throws:
InvalidBooleanOperationException - if a boolean operation generates an empty solid

setOperationToInverseDifference

public void setOperationToInverseDifference()
                                     throws InvalidBooleanOperationException
Sets the operation to inverse difference (invert the operators and apply difference)

Throws:
InvalidBooleanOperationException - if a boolean operation generates an empty solid

setOperator1

public void setOperator1(CSGSolid solid)
                  throws InvalidBooleanOperationException
Sets the first operator

Parameters:
solid - first operator
Throws:
InvalidBooleanOperationException - if a boolean operation generates an empty solid

setOperator2

public void setOperator2(CSGSolid solid)
                  throws InvalidBooleanOperationException
Sets the second operator

Parameters:
solid - second operator
Throws:
InvalidBooleanOperationException - if a boolean operation generates an empty solid

updateItselfAndParents

public void updateItselfAndParents()
                            throws InvalidBooleanOperationException
Update itself and parents (called when coordinates were changed)

Throws:
InvalidBooleanOperationException - if a boolean operation generates an empty solid

updateChildren

public void updateChildren()
Updates all its descendants (called after some transforms were performed)


copy

public CSGSolid copy()
Copies the solid

Specified by:
copy in class CSGSolid
Returns:
solid copy