Reacting to clicks in point cloud models
While point clouds doesn't have a concept of nodes, applications can detect clicked points. Just like with
CAD models, Cognite3DViewer.getIntersectionFromPixel
is used to determine world position and point from
a mouse click.
Detecting clicked positions
The following example detects intersections at clicked positions and marks the intersected positions using a red sphere.
Getting information about object assigned to a clicked point
Using Cognite's Annotations API, a user can define objects within a point cloud model.
In order to retrieve information about a clicked object, users may get the annotationId
or the assetRef
that is assigned to each point.
The annotationId
and assetRef
are available in the intersection
object returned from viewer.getIntersectionFromPixel
.
An annotation id of 0 means that the clicked point is not assigned to any object. assetRef
will only be defined if the annotation associated with the point is linked to an asset in CDF. The objects in this point cloud example have no assets associated to them.