Re: Coordinate precision (was: no subject)

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
Report Content as Inappropriate

Re: Coordinate precision (was: no subject)

Hi Anke,

have a look at the JTS FAQ: http://tsusiatsoftware.net/jts/jts-faq/jts-faq.html section D, second question.

Or try my explanation:
Line intersction points are elements of QxQ (Q is the set of rational numbers). Java double precision (JDP) can
represent only a subset of Q, thus the intersection points are rounded to the nearest elements of JDP x JDP.
In return, the rounded intersection points are (correctly) recognized as not lying on the segments.


>Hello all together,
>I have tried to understand as JTS handles with the inaccuracy from doubles. As already mentioned there still appear
mistakes with my calculations, because some values differ around 0.000000000004, although they are same. To solve this
problem I have carried out some tests with JTS and tried to comprehend. On this occasion, I found the following
difference between two equal geometrical cases:

>1. Fall:
>Linestring1:  "LINESTRING(4 1, 4 7)";
>Linestring2: "LINESTRING(1 4, 7 4)";
>With the intersection „linestring1.intersection(linestring2)“ the point „POINT (4 4)“ came out as expected.
>The question „linestring1.intersects(linestring1.intersection(linestring2))” delivered true.
>Linestring3:  "LINESTRING(-27611.19260069567 25315.392403581718, -11080.415853237311 23468.8694690252)";
>Linestring4:  "LINESTRING(-21456.11615217394 29272.22726334569, -18818.226245664628 18368.948983107195)";
>With the intersection „Linestring3.intersection(linestring4)“ the point „POINT (-20301.268838372802
24498.858366300974) „ came out.
>However the question „Linestring3.intersects(linestring3.intersection(linestring4))” returns false.
>In fact it should return true? Does one of you know an explanation of this?  Maybe someone does know who about JTS I
can contact or who knows a lot about it? Or should I announce this as a bug?
>With kind regards,
>Anke Trittenbach

jts-devel mailing list
[hidden email]