b, c, and d should all have the same performance. a will probably be twice as slow (due to two calls to predicates)

Be careful about the precise semantics of the predicates. (c) is not equivalent to (d) (for instance, a polygon which is wholely contained in another will have c = false but d = true




Jody Garnett wrote:
Here is a skill testing question for the jts-devel list. I think all of the following alternatives perform the same test .. what do you think would perform faster?

a) return geometry.disjoint( geometry2 ) || geometry.touches( geometry2 )

b) IntersectionMatrix matrix = geometry.relate( geometry2 );
   return matrix.isDisjoint() || matrix.isTouches();

c) return geometry.relate( geometry2, "F********" )

d) return !geometry.overlaps( geometry2 )

I will write a test harness for this; but the discussion may be interesting.
Jody
_______________________________________________
jts-devel mailing list
jts-devel@lists.jump-project.org
http://lists.refractions.net/mailman/listinfo/jts-devel


--
Martin Davis
Senior Technical Architect
Refractions Research, Inc.
(250) 383-3022

_______________________________________________
jts-devel mailing list
jts-devel@lists.jump-project.org
http://lists.refractions.net/mailman/listinfo/jts-devel

Reply via email to