Last updated

API / geotoolkit3d / picking / RayCastPicking / RayCastPicking

Class: RayCastPicking

picking.RayCastPicking.RayCastPicking

Picking using raycasting algorithm.

This selection strategy use a raycasting algorithm to determine what objects are at the requested location.
Note that this algorithm has some known limitations as it's a CPU approach:

  • Vertex&Fragment shader are not supported, therefore objects making use of them might not be pickable or picked at the wrong coordinates
  • Raycasting use a distance-based criteria
  • Can be slow if the picked object or any object considered as a candidate internally has a lot of triangles
  • Returns all objects at the given location that match the criteria

Hierarchy

Table of contents

Constructors
Methods

Contents

Constructors

new RayCastPicking()

new RayCastPicking()

Overrides

AbstractPicking.constructor

Methods

getClassName

getClassName(): string

Returns

string

Inherited from

AbstractPicking.getClassName


getClassName

Static getClassName(): string

Returns

string

Inherited from

AbstractPicking.getClassName


getPickingRay

Static getPickingRay(plot, x, y): Ray

Return the Ray on the given plot at the given screen coordinates.

Parameters

Name Type Description
plotPlotThe target plot
xnumberThe x coordinate in plot device space
ynumberThe y coordinate in plot device space

Returns

Ray


getPickingRayClient

Static getPickingRayClient(plot, x, y): Ray

Return the Ray on the given plot at the given screen coordinates.

Parameters

Name Type Description
plotPlotThe target plot
xnumberThe x coordinate in client device space
ynumberThe y coordinate in client device space

Returns

Ray


pick

Static pick(plot, x, y): PickingResult[]

Cast a ray at the given pixel location (relative to the plot).

Objects close enough to the ray will be retrieved by the raycast operation.

Parameters

Name Type Description
plotPlotThe target plot
xnumberThe x coordinate in device space (pixels)
ynumberThe x coordinate in device space (pixels)

Returns

PickingResult[]

An array of PickingResult containing the intersecting shapes

Overrides

AbstractPicking.pick