PolylineGeometry and picking

Hi there,

I'd like to pick a PolylineGeometry to get the exact coordinate/index of
the vertex/node I picked, like it's possible when picking a Model. Is
this somehow possible?

As some background information: I'm working on a online flight analysis
project. Users can view track logs of flights, and when they hover of
the track, additional information for that exact position (e.g.
climbrate, speed, ...) is shown. See
SkyLines for example... We'd like to
support 3d graphics, too, hence the question.

Tobias

0x740A78A5.asc (1.7 KB)

If look at Globe.prototype.pick in

https://github.com/AnalyticalGraphicsInc/cesium/blob/master/Source/Scene/Globe.js

You’ll notice that it first checks ray to sphere intersections. So treating each point of the path as a sphere center with some radius you could quickly narrow down the closest path node. Sphere radius should scale with distance from camera. Then of the intersected spheres figure out which center is closest to the point of intersection.

node A: closest node

node B: next node down the chain

path vector: from node A to node B

intersect vector: from node A to where sphere was intersected

Then using dot product of those vectors you can figure how far from that node A to the next node B. If the dot product is negative then instead do the same thing using the node before that one to get a positive value.

Then you know how far from node A to node B, so you can do accurate interpolation.This should work in 3D even when the camera is tilted.

(if there is a ray to cylinder intersect function that will be better.)