I haven't come across the notion of "penetration depth" before - very interesting! It seems that the usual definition is:

The (overall) penetration depth, (A;B) is defined as the minimum amount of translational motion required in any direction required to make the interior of A disjoint from B
(from this paper:
http://www.cs.duke.edu/courses/spring07/cps296.2/course_projects/shashi_proj.pdf
)

It looks like this is a non-trivial computation, except possibly in the case of both polygons being convex. There's nothing in JTS at the moment which computes this value. The technique used by the distance algorithm to compute distance = 0 is quite different and much simpler, and can't be amended to compute penetration depth (As you might see, there's a big difference between computing a 0 value for something, and computing a non-zero value which describes a complex situation)

The survey paper lists the current best algorithms for various cases (both convex, one convex). I'm not sure if they're similar to the GJK algorithm. Seems like they'd be fairly complex to implement (unless perhaps some existing code can be found and adapted to JTS).

Jim Kay wrote:

Is there an easy way to calculate by how much geometries (say polygons) overlap?
I am thinking of the collision-detection problem of 'penetration depth'.
The distance method returns zero for overlapping polygons - could this be amended to give a negative distance?

Would my request require something like the GJK algorithm, and would that be difficult to implement?

*/Jim/*

Jim Kay
Senior Engineer
Interfleet Technology Ltd
email:  ka...@interfleet.co.uk
tel:    +44 (0) 1332 223229
fax:    +44 (0) 1332 223181
mobile: +44 (0) 7715 536828
web:    _www.interfleet.co.uk_ <file://www.interfleet.co.uk>

Interfleet Technology Ltd
Interfleet House
Pride Parkway
Derby
DE24 8HX



**********************************************************************
Interfleet Technology Ltd

Interfleet Technology's email disclaimer is found via the following
URL: http://www.interfleet-technology.com/disclaimer.asp

Registered Offices:
http://www.interfleet-technology.com/offices.asp

Please consider the environment before printing this e-mail.
**********************************************************************

------------------------------------------------------------------------

_______________________________________________
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