how to find what are the lat longs intersecting on polyline

1. A concise explanation of the problem you're experiencing.
how to find what are the lat longs intersecting on polyline

2. A minimal code example. If you've found a bug, this helps us reproduce and repair it.

3. Context. Why do you need to do this? We might know a better way to accomplish your goal.

Function to find what are the lat longs intersecting on polyline

4. The Cesium version you're using, your operating system and browser.
1.39 cesuim, window 10

Hi,

I don’t think there’s a way to directly check if something intersects with a polyline, but you can check yourself using the positions and IntersectionTests.

Thanks,

Gabby

Hi Gabby,

I have tried below code to find intersecting coordinates between from start to end lat longs.

I didn’t get any data.

please help me with functionality.

below code i tried:

Hi

as per github tried below code, received as “undefined”. please suggest.

https://github.com/knreise/cesium-minimap/blob/master/Cesium-1.11/Build/Documentation/IntersectionTests.html

code:

Hi Dhana,

I’m still not sure what you are trying to accomplish. Are you trying to test if those two point intersect the line segment, or is the second set of points it’s own line segment?

I think this is not so much a problem with the Cesium API, but rather a geometry problem. You might have more success asking on a Math forum. Then if you then have specific questions about Cesium ask them here.

Thanks,

Gabby

Hi Gabby,

I have tried and implemented the functionality. Thank you.

Regards

Dhana

Hi Gabby,

Is that possible to compare with an array intersecting between starting and ending point?

I want to test an array of coordinates in center with starting and ending point.

something like this as below example: Please guide me.

var viewer = new Cesium.Viewer(‘cesiumContainer’);

var p0 = Cesium.Cartesian3.fromDegrees([78.38126509772302,17.451123346716912]);

var p1 = Cesium.Cartesian3.fromDegrees([78.3815350820249,17.451429693791102]);

var center=Cesium.Cartesian3.fromDegreesArray([78.38133429279841,17.451203141578144]);

var sphere= new Cesium.BoundingSphere(center,0);

alert(sphere);

var intersections = Cesium.IntersectionTests.lineSegmentSphere(p0, p1, sphere);

alert(intersections);

Regards

Dhana

Hi Dhana,

There’s nothing special in the Cesium API to do that, you should be able to iterate through an array of Cartesian3’s and tests the intersections.

Thanks,

Gabby