java.lang.Object
de.grogra.rgg.AvoidIntersection
- All Implemented Interfaces:
VolumeListener
,Options
Instances of
Example to use:
The node gets a new direction.
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
FieldsModifier and TypeFieldDescriptionstatic final int
static final int
static final int
-
Constructor Summary
ConstructorsConstructorDescriptionCreate an instance ofAvoidIntersection
with 100 rays.AvoidIntersection
(int RayCount) Create an instance ofAvoidIntersection
withRayCount
rays. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addFavorNode
(Node node) Addsnode
to the list offavorNodes
.void
beginGroup
(Object object, boolean asNode) This method is invoked by aSceneVisitor
when subsequent volumes shall be grouped into a single compound object.void
endGroup()
This method is invoked by aSceneVisitor
when the current group ends.Returns the option value for the option identified bykey
.boolean
This method works exactly likelook(Null, float, float, boolean)
.boolean
This methods compute based on a intersection test with rays a new direction fornode.
void
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 infavorNodes
.void
setFavorNodeType
(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
This method sets theprepareScene
flag.void
setRange
(float width, float height) For explanation seesetRange(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
(Object object, boolean asNode, Volume volume) This method is invoked by aSceneVisitor
when avolume
is created as representation of the geometry ofobject
.
-
Field Details
-
NO_HIT
public static final int NO_HIT- See Also:
-
FRIENDLY_HIT
public static final int FRIENDLY_HIT- See Also:
-
UNFRIENDLY_HIT
public static final int UNFRIENDLY_HIT- See Also:
-
-
Constructor Details
-
AvoidIntersection
public AvoidIntersection()Create an instance ofAvoidIntersection
with 100 rays. -
AvoidIntersection
public AvoidIntersection(int RayCount) Create an instance ofAvoidIntersection
withRayCount
rays.- Parameters:
RayCount
- Number of rays.
-
-
Method Details
-
setLayerVisible
public void setLayerVisible(int id, boolean visible) Set layer #id
to visible (true) or invisible (false).- Parameters:
id
- Layer idvisible
- Layer visible or not.
-
setPrepareScene
public void setPrepareScene()This method sets theprepareScene
flag. When the methodprepareScene()
is invoked, an octree will re-computed. -
setRange
public void setRange(float width, float height) For explanation seesetRange(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. WithpredictedLength
the origin of all rays is shift along the direction line of theoriginNode
.- Parameters:
width
- Width of the tested space.height
- Height of the tested space.predictedLength
- Distance of shifting the ray origin.
-
setFavorNodeType
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 isclassName
.- Parameters:
className
- Interface type which is implemented by some objects of the scene.
-
addFavorNode
Addsnode
to the list offavorNodes
. Ray intersection with thisnode
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
-
-
setDistance2Surface
public void setDistance2Surface(float distance) This method sets the distance of tangential plane to all nodes infavorNodes
.- Parameters:
distance
- Distance to surface
-
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 methodlook(Null node, float size, float distance)
invoke this automatically. -
look
This method works exactly likelook(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
This methods compute based on a intersection test with rays a new direction fornode. The area in front of
node
is defined bysetRange(float, float, float)
and bydistance
. Iff a new direction is calculated a transformation node which approximate the new direction by the given value ofstrength
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 ofnode
, set this parameter true.- Returns:
- Iff every ray has an unfriendly intersection with objects, this method return false otherwise true.
-
get
Description copied from interface:Options
Returns the option value for the option identified bykey
. If no special value for the option is defined,defaultValue
is returned. -
volumeCreated
Description copied from interface:VolumeListener
This method is invoked by aSceneVisitor
when avolume
is created as representation of the geometry ofobject
. 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 interfaceVolumeListener
- Parameters:
object
- an object of the graphasNode
- isobject
a node or an edge?volume
- the volume which has been created as geometrical representation ofobject
-
beginGroup
Description copied from interface:VolumeListener
This method is invoked by aSceneVisitor
when subsequent volumes shall be grouped into a single compound object. The group extends until the corresponding invocation ofVolumeListener.endGroup()
. These invocations may be nested, i.e., there may be groups within groups.Each group starts at
object
in the graph. Ifobject
has a geometric representation itself, the corresponding invocation ofVolumeListener.volumeCreated(java.lang.Object, boolean, de.grogra.vecmath.geom.Volume)
may be either immediately before of afterbeginGroup
.- Specified by:
beginGroup
in interfaceVolumeListener
- Parameters:
object
- the object of the graph which represents the root of the groupasNode
- isobject
a node or an edge?- See Also:
-
endGroup
public void endGroup()Description copied from interface:VolumeListener
This method is invoked by aSceneVisitor
when the current group ends.- Specified by:
endGroup
in interfaceVolumeListener
- See Also:
-