|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.grogra.rgg.AvoidIntersection
public class AvoidIntersection
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.
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 |
---|
public static final int FRIENDLY_HIT
public static final int NO_HIT
public static final int UNFRIENDLY_HIT
Constructor Detail |
---|
public AvoidIntersection()
AvoidIntersection
with
100 rays.
public AvoidIntersection(int RayCount)
AvoidIntersection
with
RayCount
rays.
RayCount
- Number of rays.Method Detail |
---|
public void addFavorNode(Node node)
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.
node
- public void beginGroup(java.lang.Object object, boolean asNode)
VolumeListener
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
.
beginGroup
in interface VolumeListener
object
- the object of the graph which represents the root
of the groupasNode
- is object
a node or an edge?VolumeListener.endGroup()
public void endGroup()
VolumeListener
SceneVisitor
when the current group
ends.
endGroup
in interface VolumeListener
VolumeListener.beginGroup(java.lang.Object, boolean)
public java.lang.Object get(java.lang.String key, java.lang.Object defaultValue)
Options
key
. If no special value for the option is defined,
defaultValue
is returned.
get
in interface Options
key
- identifier for optiondefaultValue
- default value of option
key
public boolean look(Null node, float distance)
look(Null, float, float, boolean)
. Expect that the
strength of changing the direction is set to 1 and no rays were visualized.
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.
public boolean look(Null node, float distance, float strength, boolean showLines)
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.
public void prepareScene()
look(Null node, float size, float distance)
invoke this automatically.
public void setDistance2Surface(float distance)
favorNodes
.
distance
- Distance to surfacepublic void setFavorNodeType(java.lang.Class<?> className)
className
.
className
- Interface type which is implemented by some objects of the
scene.public void setLayerVisible(int id, boolean visible)
id
to visible (true) or invisible (false).
id
- Layer idvisible
- Layer visible or not.public void setPrepareScene()
prepareScene
flag. When the method
prepareScene()
is invoked, an octree will re-computed.
public void setRange(float width, float height)
setRange(float, float, float)
.
width
- Width of the tested space.height
- Height of the tested space.public void setRange(float width, float height, float predictedLength)
predictedLength
the origin of all rays is shift along
the direction line of the originNode
.
width
- Width of the tested space.height
- Height of the tested space.predictedLength
- Distance of shifting the ray origin.public void volumeCreated(java.lang.Object object, boolean asNode, Volume volume)
VolumeListener
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.
volumeCreated
in interface VolumeListener
object
- an object of the graphasNode
- is object
a node or an edge?volume
- the volume which has been created as geometrical
representation of object
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |