APIdia Launch Partner
Top Description Fields Constructors Methods
javafx.scene.input

public Class PickResult

extends Object
Class Inheritance
Imports
javafx.beans.NamedArg, javafx.event.EventTarget, javafx.geometry.Point2D, .Point3D, javafx.scene.Node

A container object that contains the result of a pick event
Since
JavaFX 8.0

Field Summary

Modifier and TypeField and Description
private double
private int
public static final int
FACE_UNDEFINED

An undefined face.

private Node
private Point3D
private Point3D
private Point2D

Constructor Summary

AccessConstructor and Description
public
PickResult(Node
The intersected node
node
,
Point3D
The intersected point in local coordinate of the picked Node
point
,
double
The intersected distance between camera position and the picked Node
distance
,
int
The intersected face of the picked Node
face
,
Point2D
The intersected texture coordinates of the picked Node
texCoord
)

Creates a new instance of PickResult.

public
PickResult(Node
The intersected node
node
,
Point3D
The intersected point in local coordinate of the picked Node
point
,
double
The intersected distance between camera position and the picked Node
distance
,
int
The intersected face of the picked Node
face
,
Point3D
The intersected normal of the picked Node
normal
,
Point2D
The intersected texture coordinates of the picked Node
texCoord
)

Creates a new instance of PickResult.

public
PickResult(Node
The intersected node
node
,
Point3D
The intersected point in local coordinate of the picked Node
point
,
double
The intersected distance between camera position and the picked Node
distance
)

Creates a new instance of PickResult for a non-3d-shape target.

public
PickResult(EventTarget
The picked target (null in case of a Scene)
target
,
double
The scene X coordinate
sceneX
,
double
The scene Y coordinate
sceneY
)

Creates a pick result for a 2D case where no additional information is needed.

Method Summary

Modifier and TypeMethod and Description
public final double

Returns:

the distance from camera to the intersection
getIntersectedDistance
()

Returns the intersected distance between camera position and the intersected point.

public final int

Returns:

the picked face
getIntersectedFace
()

Returns the intersected face of the picked Node, FACE_UNDEFINED if the node doesn't have user-specified faces or was picked on bounds.

public final Node

Returns:

the picked node or null if no node was picked
getIntersectedNode
()

Returns the intersected node.

public final Point3D

Returns:

a new Point3D presenting the intersected normal
getIntersectedNormal
()

Return the intersected normal of the picked 3d shape.

public final Point3D

Returns:

new Point3D presenting the intersected point
getIntersectedPoint
()

Returns the intersected point in local coordinate of the picked Node.

public final Point2D

Returns:

a new Point2D presenting the intersected TexCoord
getIntersectedTexCoord
()

Return the intersected texture coordinates of the picked 3d shape.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

distanceback to summary
private double distance
faceback to summary
private int face
FACE_UNDEFINEDback to summary
public static final int FACE_UNDEFINED

An undefined face. This value is used for the intersected face if the picked node has no user-specified faces.

nodeback to summary
private Node node
normalback to summary
private Point3D normal
pointback to summary
private Point3D point
texCoordback to summary
private Point2D texCoord

Constructor Detail

PickResultback to summary
public PickResult(Node node, Point3D point, double distance, int face, Point2D texCoord)

Creates a new instance of PickResult.

Parameters
node:Node

The intersected node

point:Point3D

The intersected point in local coordinate of the picked Node

distance:double

The intersected distance between camera position and the picked Node

face:int

The intersected face of the picked Node

texCoord:Point2D

The intersected texture coordinates of the picked Node

PickResultback to summary
public PickResult(Node node, Point3D point, double distance, int face, Point3D normal, Point2D texCoord)

Creates a new instance of PickResult.

Parameters
node:Node

The intersected node

point:Point3D

The intersected point in local coordinate of the picked Node

distance:double

The intersected distance between camera position and the picked Node

face:int

The intersected face of the picked Node

normal:Point3D

The intersected normal of the picked Node

texCoord:Point2D

The intersected texture coordinates of the picked Node

Since
JavaFX 8u40
PickResultback to summary
public PickResult(Node node, Point3D point, double distance)

Creates a new instance of PickResult for a non-3d-shape target. Sets face to FACE_UNDEFINED and texCoord to null.

Parameters
node:Node

The intersected node

point:Point3D

The intersected point in local coordinate of the picked Node

distance:double

The intersected distance between camera position and the picked Node

PickResultback to summary
public PickResult(EventTarget target, double sceneX, double sceneY)

Creates a pick result for a 2D case where no additional information is needed. Converts the given scene coordinates to the target's local coordinate space and stores the value as the intersected point. Sets intersected node to the given target, distance to 1.0, face to FACE_UNDEFINED and texCoord to null.

Parameters
target:EventTarget

The picked target (null in case of a Scene)

sceneX:double

The scene X coordinate

sceneY:double

The scene Y coordinate

Method Detail

getIntersectedDistanceback to summary
public final double getIntersectedDistance()

Returns the intersected distance between camera position and the intersected point.

Returns:double

the distance from camera to the intersection

getIntersectedFaceback to summary
public final int getIntersectedFace()

Returns the intersected face of the picked Node, FACE_UNDEFINED if the node doesn't have user-specified faces or was picked on bounds.

Returns:int

the picked face

getIntersectedNodeback to summary
public final Node getIntersectedNode()

Returns the intersected node. Returns null if there was no intersection with any node and the scene was picked.

Returns:Node

the picked node or null if no node was picked

getIntersectedNormalback to summary
public final Point3D getIntersectedNormal()

Return the intersected normal of the picked 3d shape. If the picked target is not Shape3D or has pickOnBounds==true, it returns null.

Returns:Point3D

a new Point3D presenting the intersected normal

Since
JavaFX 8u40
getIntersectedPointback to summary
public final Point3D getIntersectedPoint()

Returns the intersected point in local coordinate of the picked Node. If no node was picked, it returns the intersected point with the projection plane.

Returns:Point3D

new Point3D presenting the intersected point

getIntersectedTexCoordback to summary
public final Point2D getIntersectedTexCoord()

Return the intersected texture coordinates of the picked 3d shape. If the picked target is not Shape3D or has pickOnBounds==true, it returns null.

Returns:Point2D

a new Point2D presenting the intersected TexCoord

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Annotations
@Override