: Class DistanceLOD

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## javax.media.j3d
Class DistanceLOD

    java.lang.Object
      |
      +--javax.media.j3d.SceneGraphObject
            |
            +--javax.media.j3d.Node
                  |
                  +--javax.media.j3d.Leaf
                        |
                        +--javax.media.j3d.Behavior
                              |
                              +--javax.media.j3d.LOD
                                    |
                                    +--javax.media.j3d.DistanceLOD

public class DistanceLOD
extends LOD

This class defines a distance-based LOD behavior node that operates on a Switch group node to select one of the children of that Switch node based on the distance of this LOD node from the viewer. An array of n monotonically increasing distance values is specified, such that distances[0] is associated with the highest level of detail and distances[n-1] is associated with the lowest level of detail. Based on the actual distance from the viewer to this DistanceLOD node, these n distance values [0, n-1] select from among n+1 levels of detail [0, n]. If d is the distance from the viewer to the LOD node, then the equation for determining which level of detail (child of the Switch node) is selected is:

0, if d <= distances[0]
i, if distances[i-1] < d <= distances[i]
n, if d > distances[n-1]

Note that both the position and the array of distances are specified in the local coordinate system of this node.

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_PICK, ALLOW_PICKABLE_READ, ALLOW_PICKABLE_WRITE, ENABLE_COLLISION_REPORTING, ENABLE_PICK_REPORTING`

Constructor Summary
`DistanceLOD()` Constructs and initializes a DistanceLOD node with default values.
`DistanceLOD(float[] distances)` Constructs and initializes a DistanceLOD node with the specified array of distances and a default position of (0,0,0).
`DistanceLOD(float[] distances, Point3f position)` Constructs and initializes a DistanceLOD node with the specified array of distances and the specified position.

Method Summary
`Node` | `cloneNode(boolean forceDuplicate)` Used to create a new instance of the node.
`void` | `duplicateNode(Node originalNode, boolean forceDuplicate)` Copies all node information from `originalNode` into the current node.
`double` | `getDistance(int whichDistance)` Returns a particular LOD cut-off distance.
`void` | `getPosition(Point3f position)` Retrieves the current position of this LOD node.
`void` | `initialize()` Initialize method that sets up initial wakeup criteria.
`int` | `numDistances()` Returns a count of the number of LOD distance cut-off parameters.
`void` | `processStimulus(java.util.Enumeration criteria)` Process stimulus method that computes appropriate level of detail.
`void` | `setDistance(int whichDistance, double distance)` Sets a particular LOD cut-off distance.
`void` | `setPosition(Point3f position)` Sets the position of this LOD node.

Methods inherited from class javax.media.j3d.LOD
`addSwitch, getAllSwitches, getSwitch, insertSwitch, numSwitches, removeSwitch, setSwitch, updateNodeReferences`

Methods inherited from class javax.media.j3d.Behavior
`getEnable, getSchedulingBoundingLeaf, getSchedulingBounds, getView, postId, setEnable, setSchedulingBoundingLeaf, setSchedulingBounds, wakeupOn`

Methods inherited from class javax.media.j3d.Node
`cloneTree, cloneTree, cloneTree, getBounds, getBoundsAutoCompute, getCollidable, getLocalToVworld, getLocalToVworld, getParent, getPickable, setBounds, setBoundsAutoCompute, setCollidable, setPickable`

Methods inherited from class javax.media.j3d.SceneGraphObject
`clearCapability, duplicateSceneGraphObject, getCapability, getUserData, isCompiled, isLive, setCapability, setUserData`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### DistanceLOD

    public DistanceLOD()

  Constructs and initializes a DistanceLOD node with default values. Note that the default constructor creates a DistanceLOD object with a single distance value set to 0.0 and is, therefore, not useful.

### DistanceLOD

    public DistanceLOD(float[] distances)

  Constructs and initializes a DistanceLOD node with the specified array of distances and a default position of (0,0,0).
  Parameters:
    `distances` - an array of values representing LOD cutoff distances

### DistanceLOD

    public DistanceLOD(float[] distances,
                       Point3f position)

  Constructs and initializes a DistanceLOD node with the specified array of distances and the specified position.
  Parameters:
    `distances` - an array of values representing LOD cutoff distances
    `position` - the position of this LOD node

Method Detail

### setPosition

    public final void setPosition(Point3f position)

  Sets the position of this LOD node. This position is specified in the local coordinates of this node, and is the position from which the distance to the viewer is computed.
  Parameters:
    `position` - the new position

### getPosition

    public final void getPosition(Point3f position)

  Retrieves the current position of this LOD node. This position is in the local coordinates of this node.
  Parameters:
    `position` - the object that will receive the current position

### numDistances

    public final int numDistances()

  Returns a count of the number of LOD distance cut-off parameters. Note that the number of levels of detail (children of the Switch node) is one greater than the number of distance values.
  Returns:
    a count of the LOD cut-off distances

### getDistance

    public final double getDistance(int whichDistance)

  Returns a particular LOD cut-off distance.
  Parameters:
    `whichDistance` - an index specifying which LOD distance to return
  Returns:
    the cut-off distance value associated with the index provided

### setDistance

    public final void setDistance(int whichDistance,
                                  double distance)

  Sets a particular LOD cut-off distance.
  Parameters:
    `whichDistance` - an index specifying which LOD distance to modify
    `distance` - the cut-off distance associated with the index provided

### initialize

    public void initialize()

  Initialize method that sets up initial wakeup criteria.
  Overrides:
    initialize in class Behavior

### processStimulus

    public void processStimulus(java.util.Enumeration criteria)

  Process stimulus method that computes appropriate level of detail.
  Overrides:
    processStimulus in class Behavior
  Parameters:
    `criteria` - an enumeration of the criteria that caused the stimulus

### cloneNode

    public Node cloneNode(boolean forceDuplicate)

  Used to create a new instance of the node. This routine is called by `cloneTree` to duplicate the current node.
  Overrides:
    cloneNode in class Node
  Parameters:
    `forceDuplicate` - when set to `true`, causes the `duplicateOnCloneTree` flag to be ignored. When `false`, the value of each node's `duplicateOnCloneTree` variable determines whether NodeComponent data is duplicated or copied.
  See Also:
    `Node.cloneTree()`, `Node.cloneNode(boolean)`, `Node.duplicateNode(javax.media.j3d.Node, boolean)`, `NodeComponent.setDuplicateOnCloneTree(boolean)`

### duplicateNode

    public void duplicateNode(Node originalNode,
                              boolean forceDuplicate)

  Copies all node information from `originalNode` into the current node. This method is called from the `cloneNode` method which is, in turn, called by the `cloneTree` method.

  For any NodeComponent objects contained by the object being duplicated, each NodeComponent object's `duplicateOnCloneTree` value is used to determine whether the NodeComponent should be duplicated in the new node or if just a reference to the current node should be placed in the new node. This flag can be overridden by setting the `forceDuplicate` parameter in the `cloneTree` method to `true`.

  Overrides:
    duplicateNode in class Behavior
  Parameters:
    `originalNode` - the original node to duplicate.
    `forceDuplicate` - when set to `true`, causes the `duplicateOnCloneTree` flag to be ignored. When `false`, the value of each node's `duplicateOnCloneTree` variable determines whether NodeComponent data is duplicated or copied.
  See Also:
    `Node.cloneTree()`, `Node.cloneNode(boolean)`, `NodeComponent.setDuplicateOnCloneTree(boolean)`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD