Search code examples
trigonometrycesiumjs

CesiumJS calculate intersectio between polyline and circle area


I am currently working on a CesiumJS based project, where i need to mark the location of the intersection between a polyline and a virtual circle shaped area on the surface. In general I could use basic trigonometry but I was wondering if there are build in tools in Cesium. The documentation on the Cesium.IntersectionTests I have found so far is a bit weak. I see that there is

Cesium.IntersectionTests.lineSegmentPlane

which returns a cartesian but

Cesium.IntersectionTests.lineSegmentSphere

returns an "Interval"

Can anyone here shine some light on that?

Thanks!


Solution

  • When 3d geometry and 2d geometry intersects there are two intersection points. because of Interval can stores scalar points along the ray, the return value is Interval. whereas if there are two 2D geometries, the intersection result is definitely one caretesian point or null (when they do not intersect)