Is there a performance difference between IHitTest and IProximityOperator?

1884
3
11-03-2014 01:35 PM
ericliprandi
New Contributor III

I came across some old code in our code base that first looks if a geometry/shape implements IHitTest. If it does, it uses HitTest(...) to determine the distance between the two geometries. If it does not implement IHitTest, it uses IProximityOperator.ReturnDistance(...).

Knowing that we are only interested in the distance between the two features/geometries, is there a recommendation as to which to use IHitTest or IProximityOperator ?

Tags (3)
0 Kudos
3 Replies
ErinBrimhall
Occasional Contributor II

Based strictly on the inputs and outputs of IHitTest.HitTest vs. IProximityOperator.ReturnDistance, you could infer that HitTest is most likely a heavier call, but you can't know for certain without running some performance tests with your data.

Is there anything else to the code that would explain the preference of HitTest over ReturnDistance, e.g. are the QueryPoint, searchRadius, or geometryPart parameters being used in ways that could produce different results compared to ReturnDistance?

0 Kudos
ericliprandi
New Contributor III

Erin,

Thanks for the reply. From the HitTest() call, only the return value (Boolean) and distance are actually used. So, I am fairly confident that's the only information we care about. I have a feeling someone had an idea to use some of the other information for something else but never got around to doing it.

0 Kudos
ErinBrimhall
Occasional Contributor II

Hi Eric,

So long as the performance and results are at least as good or better, I would lean toward using the simpler ReturnDistance method if you are itching to change this code.

I'd also be curious to learn what you find If you do end up comparing the performance of these two methods.

0 Kudos