Detect Where Polyline Intersects With Terrain

Hi,
I am trying to detect where a polyline intersects with the terrain on the Earth. I have a polyline that begins at some point in the air and is drawn towards the Earth at a certain angle. Right now I am calculating the end point just using a set distance, so I have a start and endPoint. I want to detect where this polyline first hits the Earth’s surface and stop drawing it at that point. For example, if there is a tall mountain, I don’t want the line to continue on the other side of the mountain. I’ve tried a few different approaches using IntersectionTests, specifically the grazingAltitudeLocation and rayEllipsoid but have not had any luck. I have been creating a ray with the start and end points of my polyline and then using the viewer.scene.globe.ellipsoid as the ellipsoid in the functions. I keep getting the starting point as the intersection point. Does anyone have any idea what I am doing wrong, or suggestions on a different way to do this? Any help would be greatly appreciated. Thanks.

Stephanie

Kevin/Alex/Dan, do you have any thoughts on this?

I don’t think we have any ray-intersection tests that work with terrain yet. Part of the problem (I think, this isn’t an area I’m super familiar with) is that in order to do the test on the client, you would have to load terrain tiles from the server. Without walking the ray and loading all of the tiles along it; it’s impossible to produce consistent/correct results. It may be possible to have a function that only uses the currently loaded tile-set; but at that point you are trading off fidelity. I’m not sure we have a GitHub issue on the subject (it may be on the terrain roadmap). If it isn’t; we should definitely add it.