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

## de.grogra.rgg
Class AvoidIntersection

    java.lang.Object
      de.grogra.rgg.AvoidIntersection

All Implemented Interfaces:
  VolumeListener, Options

    public class AvoidIntersection

extends java.lang.Object
implements Options, VolumeListener

Instances of `AvoidIntersection` helps to detected potential intersection by using rays (`Line`). Before something grow in a certain direction, this helps to check if objects lies in the near environment of the growing-direction.
Example to use:
`AvoidIntersection ai = new AvoidIntersection(100);
ai.look(node);
`
The node gets a new direction.

Author:
  Stephan Rogge

Field Summary
`static int` | `FRIENDLY_HIT`
`static int` | `NO_HIT`
`static int` | `UNFRIENDLY_HIT`

Constructor Summary
`AvoidIntersection()` Create an instance of `AvoidIntersection` with 100 rays.
`AvoidIntersection(int RayCount)` Create an instance of `AvoidIntersection` with `RayCount` rays.

Method Summary
`void` | `addFavorNode(Node node)` Adds `node` to the list of `favorNodes`.
`void` | `beginGroup(java.lang.Object object, boolean asNode)` This method is invoked by a `SceneVisitor` when subsequent volumes shall be grouped into a single compound object.
`void` | `endGroup()` This method is invoked by a `SceneVisitor` when the current group ends.
`java.lang.Object` | `get(java.lang.String key, java.lang.Object defaultValue)` Returns the option value for the option identified by `key`.
`boolean` | `look(Null node, float distance)` This method works exactly like `look(Null, float, float, boolean)`.
`boolean` | `look(Null node, float distance, float strength, boolean showLines)` This methods compute based on a intersection test with rays a new direction for `node.`
`void` | `prepareScene()` This method prepare the whole scene, may for a new intersection-computation.
`void` | `setDistance2Surface(float distance)` This method sets the distance of tangential plane to all nodes in `favorNodes`.
`void` | `setFavorNodeType(java.lang.Class<?> className)` To get more or less tangential directions to certain objects (called as favor nodes), we have mark them.
`void` | `setLayerVisible(int id, boolean visible)` Set layer # `id` to visible (true) or invisible (false).
`void` | `setPrepareScene()` This method sets the `prepareScene` flag.
`void` | `setRange(float width, float height)` For explanation see `setRange(float, float, float)`.
`void` | `setRange(float width, float height, float predictedLength)` Set the width and height of the space which has to be test on intersection.
`void` | `volumeCreated(java.lang.Object object, boolean asNode, Volume volume)` This method is invoked by a `SceneVisitor` when a `volume` is created as representation of the geometry of `object`.

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

Field Detail

### FRIENDLY_HIT

    public static final int FRIENDLY_HIT

See Also:
  Constant Field Values

### NO_HIT

    public static final int NO_HIT

See Also:
  Constant Field Values

### UNFRIENDLY_HIT

    public static final int UNFRIENDLY_HIT

See Also:
  Constant Field Values

Constructor Detail

### AvoidIntersection

    public AvoidIntersection()

  Create an instance of `AvoidIntersection` with 100 rays.

### AvoidIntersection

    public AvoidIntersection(int RayCount)

  Create an instance of `AvoidIntersection` with `RayCount` rays.

  Parameters:
    `RayCount` - Number of rays.

Method Detail

### addFavorNode

    public void addFavorNode(Node node)

  Adds `node` to the list of `favorNodes`. Ray intersection with this `node` is marked as friendly. So a direction is calculated which is approximate tangential to the surface at the point where the intersection was computed.

  Parameters:
    `node` -

### beginGroup

    public void beginGroup(java.lang.Object object,
                           boolean asNode)

  Description copied from interface: `VolumeListener`
  This method is invoked by a `SceneVisitor` when subsequent volumes shall be grouped into a single compound object. The group extends until the corresponding invocation of `VolumeListener.endGroup()`. These invocations may be nested, i.e., there may be groups within groups.

  Each group starts at `object` in the graph. If `object` has a geometric representation itself, the corresponding invocation of `VolumeListener.volumeCreated(java.lang.Object, boolean, de.grogra.vecmath.geom.Volume)` may be either immediately before of after `beginGroup`.

  Specified by:
    `beginGroup` in interface `VolumeListener`
  Parameters:
    `object` - the object of the graph which represents the root of the group
    `asNode` - is `object` a node or an edge?
  See Also:
    `VolumeListener.endGroup()`

### endGroup

    public void endGroup()

  Description copied from interface: `VolumeListener`
  This method is invoked by a `SceneVisitor` when the current group ends.

  Specified by:
    `endGroup` in interface `VolumeListener`
  See Also:
    `VolumeListener.beginGroup(java.lang.Object, boolean)`

### get

    public java.lang.Object get(java.lang.String key,
                                java.lang.Object defaultValue)

  Description copied from interface: `Options`
  Returns the option value for the option identified by `key`. If no special value for the option is defined, `defaultValue` is returned.

  Specified by:
    `get` in interface `Options`
  Parameters:
    `key` - identifier for option
    `defaultValue` - default value of option
  Returns:
    value of option named `key`

### look

    public boolean look(Null node,
                        float distance)

  This method works exactly like `look(Null, float, float, boolean)`. Expect that the strength of changing the direction is set to 1 and no rays were visualized.

  Parameters:
    `node` - For this node the environment has to be checked and a new direction could be the result.
    `distance` - The distance is used as length for the rays. Thats a limitation for the near environment.
  Returns:
    Iff every ray has an unfriendly intersection with objects, this method return false otherwise true.

### look

    public boolean look(Null node,
                        float distance,
                        float strength,
                        boolean showLines)

  This methods compute based on a intersection test with rays a new direction for `node. The area in front of `node` is defined by `setRange(float, float, float)` and by `distance`. Iff a new direction is calculated a transformation node which approximate the new direction by the given value of `strength` is put into the graph. Depending on objects which is involved in intersections the new direction could be tangential to the surface of an favor node a try get away from this object.

  `
  Parameters:
    `node` - For this node the environment has to be checked and a new direction could be the result.
    `distance` - The distance is used as length for the rays. Thats a limitation for the near environment.
    `strength` - Iff a new direction is calculated, this parameter sets the strength of changing a direction.
    `showLines` - To visualize what is going on in front of `node`, set this parameter true.
  Returns:
    Iff every ray has an unfriendly intersection with objects, this method return false otherwise true.

### prepareScene

    public void prepareScene()

  This method prepare the whole scene, may for a new intersection-computation. This is necessary, when something in the scene has changed. The method `look(Null node, float size, float distance)` invoke this automatically.

### setDistance2Surface

    public void setDistance2Surface(float distance)

  This method sets the distance of tangential plane to all nodes in `favorNodes`.

  Parameters:
    `distance` - Distance to surface

### setFavorNodeType

    public void setFavorNodeType(java.lang.Class<?> className)

  To get more or less tangential directions to certain objects (called as favor nodes), we have mark them. This can be done by implementing an interface. This interface is `className`.

  Parameters:
    `className` - Interface type which is implemented by some objects of the scene.

### setLayerVisible

    public void setLayerVisible(int id,
                                boolean visible)

  Set layer # `id` to visible (true) or invisible (false).

  Parameters:
    `id` - Layer id
    `visible` - Layer visible or not.

### setPrepareScene

    public void setPrepareScene()

  This method sets the `prepareScene` flag. When the method `prepareScene()` is invoked, an octree will re-computed.

### setRange

    public void setRange(float width,
                         float height)

  For explanation see `setRange(float, float, float)`.

  Parameters:
    `width` - Width of the tested space.
    `height` - Height of the tested space.

### setRange

    public void setRange(float width,
                         float height,
                         float predictedLength)

  Set the width and height of the space which has to be test on intersection. With `predictedLength` the origin of all rays is shift along the direction line of the `originNode`.

  Parameters:
    `width` - Width of the tested space.
    `height` - Height of the tested space.
    `predictedLength` - Distance of shifting the ray origin.

### volumeCreated

    public void volumeCreated(java.lang.Object object,
                              boolean asNode,
                              Volume volume)

  Description copied from interface: `VolumeListener`
  This method is invoked by a `SceneVisitor` when a `volume` is created as representation of the geometry of `object`. By storing the information provided by the parameters, the link from graph objects (nodes and edges) to volumes can be established.

  Specified by:
    `volumeCreated` in interface `VolumeListener`
  Parameters:
    `object` - an object of the graph
    `asNode` - is `object` a node or an edge?
    `volume` - the volume which has been created as geometrical representation of `object`

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