org.jscience.biology.lsystems.common
Class Primitive

java.lang.Object
  extended by javax.media.j3d.SceneGraphObject
      extended by javax.media.j3d.Node
          extended by javax.media.j3d.Group
              extended by org.jscience.biology.lsystems.common.Primitive
Direct Known Subclasses:
TruncatedCone

public abstract class Primitive
extends javax.media.j3d.Group

Base class for all Java 3D primitives.


Field Summary
static int ENABLE_APPEARANCE_MODIFY
          Specifies that the ALLOW_APPEARANCE_READ and ALLOW_APPEARANCE_WRITE bits are to be set on the generated geometry's Shape3D nodes.
static int ENABLE_GEOMETRY_PICKING
          Specifies that the ALLOW_INTERSECT capability bit should be set on the generated geometry.
static int GENERATE_NORMALS
          Specifies that normals are generated along with the positions.
static int GENERATE_NORMALS_INWARD
          Specifies that normals are to be flipped along the surface.
static int GENERATE_TEXTURE_COORDS
          Specifies that texture coordinates are generated along with the positions.
static int GEOMETRY_NOT_SHARED
          Specifies that the geometry being created will not be shared by another scene graph node.
 
Fields inherited from class javax.media.j3d.Group
ALLOW_CHILDREN_EXTEND, ALLOW_CHILDREN_READ, ALLOW_CHILDREN_WRITE, ALLOW_COLLISION_BOUNDS_READ, ALLOW_COLLISION_BOUNDS_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_LOCALE_READ, ALLOW_PARENT_READ, ALLOW_PICKABLE_READ, ALLOW_PICKABLE_WRITE, ENABLE_COLLISION_REPORTING, ENABLE_PICK_REPORTING
 
Constructor Summary
Primitive()
          Constructs a default primitive.
 
Method Summary
protected  void cacheGeometry(int kind, float a, float b, float c, int d, int e, int flags, org.jscience.biology.lsystems.common.GeomBuffer geo)
          DOCUMENT ME!
 javax.media.j3d.Appearance getAppearance()
          Gets the appearance of the primitive (defaults to first subpart).
protected  org.jscience.biology.lsystems.common.GeomBuffer getCachedGeometry(int kind, float a, float b, float c, int d, int e, int flags)
          DOCUMENT ME!
 int getNumTriangles()
          Returns total number of triangles in this primitive.
 int getNumVertices()
          Returns total number of vertices in this primitive.
 int getPrimitiveFlags()
          Returns the flags of primitive (generate normal, textures, caching, etc).
abstract  javax.media.j3d.Shape3D getShape(int partid)
          Obtains a shape node of a subpart of the primitive.
 void setAppearance()
          Sets the main appearance of the primitive (all subparts) to a default white appearance.
abstract  void setAppearance(javax.media.j3d.Appearance ap)
          Sets the main appearance of the primitive (all subparts) to same appearance.
 void setAppearance(int partid, javax.media.j3d.Appearance ap)
          Sets the appearance of a subpart given a partid.
 void setNumTriangles(int num)
          Sets the total number of triangles in this primitive.
 void setNumVertices(int num)
          Sets total number of vertices in this primitive.
 void setPrimitiveFlags(int fl)
          Sets the flags of primitive (generate normal, textures, caching, etc).
 
Methods inherited from class javax.media.j3d.Group
addChild, cloneNode, getAllChildren, getAlternateCollisionTarget, getChild, getCollisionBounds, indexOfChild, insertChild, moveTo, numChildren, removeAllChildren, removeChild, removeChild, setAlternateCollisionTarget, setChild, setCollisionBounds
 
Methods inherited from class javax.media.j3d.Node
cloneTree, cloneTree, cloneTree, cloneTree, cloneTree, cloneTree, duplicateNode, getBounds, getBoundsAutoCompute, getCollidable, getLocale, getLocalToVworld, getLocalToVworld, getParent, getPickable, setBounds, setBoundsAutoCompute, setCollidable, setPickable
 
Methods inherited from class javax.media.j3d.SceneGraphObject
clearCapability, clearCapabilityIsFrequent, duplicateSceneGraphObject, getCapability, getCapabilityIsFrequent, getName, getUserData, isCompiled, isLive, setCapability, setCapabilityIsFrequent, setName, setUserData, toString, updateNodeReferences
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

GENERATE_NORMALS

public static final int GENERATE_NORMALS
Specifies that normals are generated along with the positions.

See Also:
Constant Field Values

GENERATE_TEXTURE_COORDS

public static final int GENERATE_TEXTURE_COORDS
Specifies that texture coordinates are generated along with the positions.

See Also:
Constant Field Values

GENERATE_NORMALS_INWARD

public static final int GENERATE_NORMALS_INWARD
Specifies that normals are to be flipped along the surface.

See Also:
Constant Field Values

GEOMETRY_NOT_SHARED

public static final int GEOMETRY_NOT_SHARED
Specifies that the geometry being created will not be shared by another scene graph node. By default all primitives created with the same parameters share their geometry (you have 50 spheres in your scene, but the geometry stored only once). A change to one primitive will effect all shared nodes. You specify this flag if you do not wish to share any geometry among primitives of the same parameters.

See Also:
Constant Field Values

ENABLE_GEOMETRY_PICKING

public static final int ENABLE_GEOMETRY_PICKING
Specifies that the ALLOW_INTERSECT capability bit should be set on the generated geometry. This allows the object to be picked using Geometry based picking.

See Also:
Constant Field Values

ENABLE_APPEARANCE_MODIFY

public static final int ENABLE_APPEARANCE_MODIFY
Specifies that the ALLOW_APPEARANCE_READ and ALLOW_APPEARANCE_WRITE bits are to be set on the generated geometry's Shape3D nodes.

See Also:
Constant Field Values
Constructor Detail

Primitive

public Primitive()
Constructs a default primitive.

Method Detail

getNumTriangles

public int getNumTriangles()
Returns total number of triangles in this primitive.

Returns:
DOCUMENT ME!

setNumTriangles

public void setNumTriangles(int num)
Sets the total number of triangles in this primitive.

Parameters:
num - DOCUMENT ME!

getNumVertices

public int getNumVertices()
Returns total number of vertices in this primitive.

Returns:
DOCUMENT ME!

setNumVertices

public void setNumVertices(int num)
Sets total number of vertices in this primitive.

Parameters:
num - DOCUMENT ME!

getPrimitiveFlags

public int getPrimitiveFlags()
Returns the flags of primitive (generate normal, textures, caching, etc).

Returns:
DOCUMENT ME!

setPrimitiveFlags

public void setPrimitiveFlags(int fl)
Sets the flags of primitive (generate normal, textures, caching, etc).

Parameters:
fl - DOCUMENT ME!

getShape

public abstract javax.media.j3d.Shape3D getShape(int partid)
Obtains a shape node of a subpart of the primitive.

Parameters:
partid - identifier for a given subpart of the primitive.
Returns:
DOCUMENT ME!

getAppearance

public javax.media.j3d.Appearance getAppearance()
Gets the appearance of the primitive (defaults to first subpart).

Returns:
DOCUMENT ME!

setAppearance

public void setAppearance(int partid,
                          javax.media.j3d.Appearance ap)
Sets the appearance of a subpart given a partid.

Parameters:
partid - DOCUMENT ME!
ap - DOCUMENT ME!

setAppearance

public abstract void setAppearance(javax.media.j3d.Appearance ap)
Sets the main appearance of the primitive (all subparts) to same appearance.

Parameters:
ap - DOCUMENT ME!

setAppearance

public void setAppearance()
Sets the main appearance of the primitive (all subparts) to a default white appearance.


cacheGeometry

protected void cacheGeometry(int kind,
                             float a,
                             float b,
                             float c,
                             int d,
                             int e,
                             int flags,
                             org.jscience.biology.lsystems.common.GeomBuffer geo)
DOCUMENT ME!

Parameters:
kind - DOCUMENT ME!
a - DOCUMENT ME!
b - DOCUMENT ME!
c - DOCUMENT ME!
d - DOCUMENT ME!
e - DOCUMENT ME!
flags - DOCUMENT ME!
geo - DOCUMENT ME!

getCachedGeometry

protected org.jscience.biology.lsystems.common.GeomBuffer getCachedGeometry(int kind,
                                                                            float a,
                                                                            float b,
                                                                            float c,
                                                                            int d,
                                                                            int e,
                                                                            int flags)
DOCUMENT ME!

Parameters:
kind - DOCUMENT ME!
a - DOCUMENT ME!
b - DOCUMENT ME!
c - DOCUMENT ME!
d - DOCUMENT ME!
e - DOCUMENT ME!
flags - DOCUMENT ME!
Returns:
DOCUMENT ME!