org.xith3d.picking
Class PickResult

java.lang.Object
  extended by org.xith3d.picking.PickResult
All Implemented Interfaces:
java.lang.Comparable<PickResult>

public class PickResult
extends java.lang.Object
implements java.lang.Comparable<PickResult>

Result of a picking action.


Field Summary
protected  org.openmali.vecmath2.Tuple3f tmpPos
           
 
Constructor Summary
PickResult(Leaf node, float dist)
          Creates a new instance of PickResult.
PickResult(Leaf node, float minDist, float maxDist, float medDist)
          Creates a new instance of PickResult.
PickResult(Leaf node, int faceIndex, float minDist, float maxDist, float medDist)
          Creates a new instance of PickResult.
 
Method Summary
 int compareTo(PickResult pr)
          Compares two PickResults according to their distances.
 boolean equals(java.lang.Object o)
           
 org.jagatoo.input.devices.components.MouseButton getButton()
           
 int getFaceIndex()
           
 Geometry getGeometry()
           
 float getMaximumDistance()
           
 float getMedialDistance()
           
 float getMinimumDistance()
           
 Leaf getNode()
           
 Node getPickHost()
           
 Node getPickHostOrNode()
           
 org.openmali.vecmath2.Tuple3f getPos()
           
 Transform3D getTransform()
           
 void setFaceIndex(int faceIndex)
           
 void setMaximumDistance(float dist)
          Sets the maximum distance to the intersection
 void setMedialDistance(float dist)
          Sets the medial distance to the intersection
 void setMinimumDistance(float dist)
          Sets the minimum distance to the intersection
 void setPos(org.openmali.vecmath2.Tuple3f pos)
           
 java.lang.String toString()
           
 void transform(org.openmali.vecmath2.Point3f p)
          Transforms a point in global-space to local space of this Shape3D.
 void transform(org.openmali.vecmath2.Ray3f ray)
          Transforms a Ray3f in global-space to local space of this Shape3D.
 void transform(org.openmali.vecmath2.Vector3f v)
          Transforms a vector in global-space to local space of this Shape3D.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

tmpPos

protected org.openmali.vecmath2.Tuple3f tmpPos
Constructor Detail

PickResult

public PickResult(Leaf node,
                  float minDist,
                  float maxDist,
                  float medDist)
Creates a new instance of PickResult.


PickResult

public PickResult(Leaf node,
                  int faceIndex,
                  float minDist,
                  float maxDist,
                  float medDist)
Creates a new instance of PickResult.


PickResult

public PickResult(Leaf node,
                  float dist)
Creates a new instance of PickResult.

Method Detail

getNode

public Leaf getNode()
Returns:
the picked Node

getPickHost

public Node getPickHost()
Returns:
the picked Shape3D's pick-host

getPickHostOrNode

public Node getPickHostOrNode()
Returns:
the picked Shape3D's pick-host, if not null. The Node itself, otherwise.

getGeometry

public Geometry getGeometry()
Returns:
the Geometry of the picked Shape3D
See Also:
getNode()

setFaceIndex

public void setFaceIndex(int faceIndex)

getFaceIndex

public int getFaceIndex()
Returns:
the index of the face which has been picked in the Shape3D
See Also:
getNode(), getGeometry()

transform

public void transform(org.openmali.vecmath2.Vector3f v)
Transforms a vector in global-space to local space of this Shape3D.

Parameters:
v - the vector to transform

transform

public void transform(org.openmali.vecmath2.Point3f p)
Transforms a point in global-space to local space of this Shape3D.

Parameters:
p - the point to transform

transform

public void transform(org.openmali.vecmath2.Ray3f ray)
Transforms a Ray3f in global-space to local space of this Shape3D.

Parameters:
ray - the ray to transform

setPos

public void setPos(org.openmali.vecmath2.Tuple3f pos)

getPos

public org.openmali.vecmath2.Tuple3f getPos()
Returns:
The position of the intersection of the PickRay with the Shape3D in global-space

setMinimumDistance

public void setMinimumDistance(float dist)
Sets the minimum distance to the intersection

Parameters:
dist - the distance

getMinimumDistance

public float getMinimumDistance()
Returns:
the minimum distance to the intersection

setMaximumDistance

public void setMaximumDistance(float dist)
Sets the maximum distance to the intersection

Parameters:
dist - the distance

getMaximumDistance

public float getMaximumDistance()
Returns:
the maximum distance to the intersection

setMedialDistance

public void setMedialDistance(float dist)
Sets the medial distance to the intersection

Parameters:
dist - the distance

getMedialDistance

public float getMedialDistance()
Returns:
the medial distance to the intersection

getButton

public final org.jagatoo.input.devices.components.MouseButton getButton()
Returns:
the mouse button, that was clicked

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
a String-representation of this PickResult object.

compareTo

public int compareTo(PickResult pr)
Compares two PickResults according to their distances.

Specified by:
compareTo in interface java.lang.Comparable<PickResult>
Parameters:
pr - the PickResult to compare to

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

getTransform

public Transform3D getTransform()