# Intersect between Surface and Ray

I am interested in finding the intersection of a Ray and a Surface in ArcObjects.

I already know of two solutions. First solution is to use the `Locate` method of ISurface:

``````Dim intersectionPoint As IPoint = surface.Locate(ray, hint)
``````

The other solution is to use the `GetLineOfSight` method of IGeoDatabaseBridge (where the variable `point` is a calculated point along the path of the ray):

``````Dim geoDatabaseBridge2 As IGeoDatabaseBridge2 = New GeoDatabaseHelper
geoDatabaseBridge2.GetLineOfSight(surface, baseRay.Origin, point, intersectionPoint, Nothing, Nothing, Nothing, False, False)
``````

Surprisingly, the `GetLineOfSight` method is much faster than the `locate` method. But I am looking for an even faster solution.

So my question is: Is there any other (and faster) ways to find the intersection between a ray and a surface? Or can you point me in the direction of literature that explains the calculations I need to roll my own?

Thanks!

UPDATE: I have started the process of creating my own Line of Sight algorithm. I have posted my current solution description in a blog post. Thanks again for all of the suggestions.

-
Is your surface based on a TIN or raster? – Kirk Kuykendall Jun 28 '11 at 13:10
The surface is based on a raster – Chris Jun 28 '11 at 13:11
Are you wanting to stick with ArcObjects? If not, have you searched for using GPU for line of sight? – Kirk Kuykendall Jun 28 '11 at 13:18
I would prefer to stick with ArcObjects. But if ArcObjects can't do it, I'll look for other options. – Chris Jun 28 '11 at 13:20
@Chris Small things make big differences. Different approaches may be best if (a) all lines of sight emanate from the same point and use the same DEM; (b) different DEMs are used; (c) a single DEM is used and all lines of sight lie above a common point; (d) there are known bounds on the slopes of the DEM; etc. It would therefore help for you to disclose more about what you really want to accomplish and some details about the nature of the surface and these rays. – whuber Jun 28 '11 at 13:48