unbboolean.bool
Class Solid

java.lang.Object
  |
  +--javax.media.j3d.SceneGraphObject
        |
        +--javax.media.j3d.Node
              |
              +--javax.media.j3d.Leaf
                    |
                    +--javax.media.j3d.Shape3D
                          |
                          +--unbboolean.bool.Solid
Direct Known Subclasses:
CSGSolid

public class Solid
extends javax.media.j3d.Shape3D

Class representing a 3D solid.

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

Field Summary
 
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
Solid()
          Constructs an empty solid.
Solid(java.io.File solidFile, javax.vecmath.Color3f color)
          Constructs a solid based on a coordinates file.
Solid(javax.vecmath.Point3d[] vertices, int[] indices, javax.vecmath.Color3f[] colors)
          Construct a solid based on data arrays.
 
Method Summary
 javax.vecmath.Color3f[] getColors()
          Gets the vertices colors
 int[] getIndices()
          Gets the solid indices for its vertices
 javax.vecmath.Point3d[] getVertices()
          Gets the solid vertices
 boolean isEmpty()
          Gets if the solid is empty (without any vertex)
 void rotate(double dx, double dy)
          Applies a rotation into a solid
 void scale(double dx, double dy, double dz)
          Applies a scale changing into the solid
 void setColor(javax.vecmath.Color3f color)
          Sets the solid color (all the vertices with the same color)
 void setData(javax.vecmath.Point3d[] vertices, int[] indices, javax.vecmath.Color3f[] colors)
          Sets the solid data.
 void translate(double dx, double dy)
          Applies a translation into a solid
 void zoom(double dz)
          Applies a zoom into a solid
 
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, toString, wait, wait, wait
 

Constructor Detail

Solid

public Solid()
Constructs an empty solid.


Solid

public Solid(javax.vecmath.Point3d[] vertices,
             int[] indices,
             javax.vecmath.Color3f[] colors)
Construct a solid based on data arrays. An exception may occur in the case of abnormal arrays (indices making references to inexistent vertices, there are less colors than vertices...)

Parameters:
vertices - array of points defining the solid vertices
indices - array of indices for a array of vertices
colors - array of colors defining the vertices colors

Solid

public Solid(java.io.File solidFile,
             javax.vecmath.Color3f color)
Constructs a solid based on a coordinates file. It contains vertices and indices, and its format is like this:

4
0 -5.00000000000000E-0001 -5.00000000000000E-0001 -5.00000000000000E-0001
1 5.00000000000000E-0001 -5.00000000000000E-0001 -5.00000000000000E-0001
2 -5.00000000000000E-0001 5.00000000000000E-0001 -5.00000000000000E-0001
3 5.00000000000000E-0001 5.00000000000000E-0001 -5.00000000000000E-0001

2
0 0 2 3
1 3 1 0

Parameters:
solidFile - file containing the solid coordinates
color - solid color
Method Detail

getVertices

public javax.vecmath.Point3d[] getVertices()
Gets the solid vertices

Returns:
solid vertices

getIndices

public int[] getIndices()
Gets the solid indices for its vertices

Returns:
solid indices for its vertices

getColors

public javax.vecmath.Color3f[] getColors()
Gets the vertices colors

Returns:
vertices colors

isEmpty

public boolean isEmpty()
Gets if the solid is empty (without any vertex)

Returns:
true if the solid is empty, false otherwise

setData

public void setData(javax.vecmath.Point3d[] vertices,
                    int[] indices,
                    javax.vecmath.Color3f[] colors)
Sets the solid data. An exception may occur in the case of abnormal arrays (indices making references to inexistent vertices, there are less colors than vertices...)

Parameters:
vertices - array of points defining the solid vertices
indices - array of indices for a array of vertices
colors - array of colors defining the vertices colors

setColor

public void setColor(javax.vecmath.Color3f color)
Sets the solid color (all the vertices with the same color)

Parameters:
color - solid color

translate

public void translate(double dx,
                      double dy)
Applies a translation into a solid

Parameters:
dx - translation on the x axis
dy - translation on the y axis

rotate

public void rotate(double dx,
                   double dy)
Applies a rotation into a solid

Parameters:
dx - rotation on the x axis
dy - rotation on the y axis

zoom

public void zoom(double dz)
Applies a zoom into a solid

Parameters:
dz - translation on the z axis

scale

public void scale(double dx,
                  double dy,
                  double dz)
Applies a scale changing into the solid

Parameters:
dx - scale changing for the x axis
dy - scale changing for the y axis
dz - scale changing for the z axis