[geos-devel] Precision model and predicates
Ben Harper
ben at gls.co.za
Thu Jan 29 03:23:12 EST 2009
I see - that's kind of what I guessed.
The reason why I'm ending up with geometries with precision less than
2^53 is because I have my application work to within a specified
tolerance (by default 1 micrometer). My intermediate representation
for polygon coordinates can be 32-bit signed integers, with scale & offset,
if this meets the precision criteria. Obviously in certain cases this
ends up being less than straight 'double' precision, and this is the
root of my problem.
In writing some of my own geometric predicate functions, I have come to
the conclusion that if one wants to work strictly to a certain precision,
then you need to make your epsilon an arbitrary value, be it a #define,
a global 'double', or whatever the case may be. In doing so, one might
as well make it a variable that the user can control.
It also occurred to me that in doing this one needs to place a priority on
the 3 principle regions (Interior, Boundary, and Exterior).
The natural order seems to be Border > Interior > Exterior.
For example:
You have a point that is actually inside a polygon, but within 'epsilon'
distance from its edge. You obviously need to make the decision whether
the point is Interior or Boundary, and in such as case it is considered
to intersect the Boundary only by virtue of the Boundary's priority over
the Interior.
I am curious as to how you have approached this in JTS, or your thoughts
on the matter?
Thanks,
Ben
-----Original Message-----
From: geos-devel-bounces at lists.osgeo.org [mailto:geos-devel-bounces at lists.osgeo.org] On Behalf Of Martin Davis
Sent: Wednesday, January 28, 2009 7:17 PM
To: GEOS Development List
Subject: Re: [geos-devel] Precision model and predicates
The Precision Model is primarily used in constructive methods. New
Geometrys are computed so that their coordinates fall on the implicit
grid defined by the Precision Model.
Currently the Precision Model is not used in evaluation of geometric
predicates. They are evaluated on the exact values of the coordinates.
What is your use case for wanting approximate predicates?
Ben Harper wrote:
>
> Hi,
>
> I'm trying to use GEOS to evaluate geometric predicates while using a
> Precision Model that is lower than the default. It looks as though the
> Precision Model is only used for certain operations, and in particular
> ignored when evaluating the border conditions of whether lines touch
> each other. I've read the JTS technical docs, and they seemed to imply
> that this type of thing should work.
>
>
>
> My test is to create two polygons side by side, with one touching
> edge. The TOUCH predicate evaluates true. I then move one polygon away
> by DBL_EPSILON (1e-16), and evaluate the predicate again. This time it
> is false. A brief step through and code search seems to reveal that
> the precision model is not used here.
>
>
>
> Am I completely missing the point?
>
>
>
> Thanks,
>
> Ben
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> geos-devel mailing list
> geos-devel at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/geos-devel
--
Martin Davis
Senior Technical Architect
Refractions Research, Inc.
(250) 383-3022
_______________________________________________
geos-devel mailing list
geos-devel at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/geos-devel
More information about the geos-devel
mailing list