<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hey all,<br>
<br>
The difference is actually in TWO coordinate pair, sorry about that:<br>
0.366 0.233<br>
vs <br>
0.384 0.218<br>
<br>
I did an area calculation on both polygons and it's the same:
14.435154<br>
<br>
Thanks,<br>
<br>
Alex<br>
<br>
On 02/01/2012 05:30 PM, Alex Trofast wrote:
<blockquote cite="mid:4F29BCFA.4090104@actian.com" type="cite">
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
<div class="moz-text-flowed" style="font-family: -moz-fixed;
font-size: 12px;" lang="x-western">Greetings all, <br>
<br>
The program pasted below will produce slightly different results
on different machines. It's calling BUFFER on a GEOMCOLLECTION.
<br>
On ArchLinux 64 bit with GCC 4.6.2 I get: <br>
Buffer: POLYGON ((0.000 1.000, 0.000 1.000, 0.011 1.113, 0.019
1.195, 0.019 1.195, 0.019 1.195, 0.043 1.275, 0.076 1.383, 0.076
1.383, 0.076 1.383, 0.113 1.451, 0.169 1.556, 0.169 1.556, 0.169
1.556, 0.184 1.574, 0.293 1.707, 0.293 1.707, 0.293 1.707, 4.293
5.707, 4.444 5.831, 4.617 5.924, 4.805 5.981, 5.000 6.000, 5.195
5.981, 5.383 5.924, 5.556 5.831, 5.707 5.707, 5.831 5.556, 5.924
5.383, 5.981 5.195, 6.000 5.000, 5.981 4.805, 5.924 4.617, 5.831
4.444, 5.707 4.293, 1.707 0.293, 1.707 0.293, 1.707 0.293, 1.707
0.293, 1.700 0.287, 1.556 0.169, 1.556 0.169, 1.556 0.169, 1.474
0.125, 1.383 0.076, 1.383 0.076, 1.383 0.076, 1.293 0.049, 1.195
0.019, 1.195 0.019, 1.195 0.019, 1.094 0.009, 1.000 0.000, 1.000
0.000, 1.000 0.000, 0.874 0.012, 0.805 0.019, 0.805 0.019, 0.805
0.019, 0.680 0.057, 0.617 0.076, 0.617 0.076, 0.617 0.076, 0.494
0.142, 0.444 0.169, 0.444 0.169, 0.444 0.169, 0.366 0.233, 0.293
0.293, 0.293 0.293, 0.293 0.293, 0.218 0.384, 0.169 0.444, 0.169
0.444, 0.169 0.444, 0.128 0.521, 0.076 0.617, 0.076 0.617, 0.076
0.617, 0.048 0.710, 0.019 0.805, 0.019 0.805, 0.019 0.805, 0.011
0.890, 0.000 1.000, 0.000 1.000)) <br>
On OpenSUSE 10 64 bit, GCC 4.1.2 <br>
Buffer: POLYGON ((0.000 1.000, 0.000 1.000, 0.011 1.113, 0.019
1.195, 0.019 1.195, 0.019 1.195, 0.043 1.275, 0.076 1.383, 0.076
1.383, 0.076 1.383, 0.113 1.451, 0.169 1.556, 0.169 1.556, 0.169
1.556, 0.184 1.574, 0.293 1.707, 0.293 1.707, 0.293 1.707, 4.293
5.707, 4.444 5.831, 4.617 5.924, 4.805 5.981, 5.000 6.000, 5.195
5.981, 5.383 5.924, 5.556 5.831, 5.707 5.707, 5.831 5.556, 5.924
5.383, 5.981 5.195, 6.000 5.000, 5.981 4.805, 5.924 4.617, 5.831
4.444, 5.707 4.293, 1.707 0.293, 1.707 0.293, 1.707 0.293, 1.707
0.293, 1.700 0.287, 1.556 0.169, 1.556 0.169, 1.556 0.169, 1.474
0.125, 1.383 0.076, 1.383 0.076, 1.383 0.076, 1.293 0.049, 1.195
0.019, 1.195 0.019, 1.195 0.019, 1.094 0.009, 1.000 0.000, 1.000
0.000, 1.000 0.000, 0.874 0.012, 0.805 0.019, 0.805 0.019, 0.805
0.019, 0.680 0.057, 0.617 0.076, 0.617 0.076, 0.617 0.076, 0.520
0.128, 0.444 0.169, 0.444 0.169, 0.444 0.169, 0.384 0.218, 0.293
0.293, 0.293 0.293, 0.293 0.293, 0.218 0.384, 0.169 0.444, 0.169
0.444, 0.169 0.444, 0.128 0.521, 0.076 0.617, 0.076 0.617, 0.076
0.617, 0.048 0.710, 0.019 0.805, 0.019 0.805, 0.019 0.805, 0.011
0.890, 0.000 1.000, 0.000 1.000)) <br>
<br>
The difference is in one coordinate pair: <br>
0.494 0.142 <br>
vs <br>
0.520 0.128 <br>
<br>
Is Buffer supposed to work on geomcollections such as the one
below and why would there be a slight discrepancy between
results? <br>
<br>
Thanks! <br>
<br>
<br>
#include <geos_c.h> <br>
#include <stdio.h> <br>
#include <stdlib.h> <br>
<br>
#define FALSE 0 <br>
#define TRUE 1 <br>
<br>
int main(int argc, char *argv[]) <br>
{ <br>
GEOSGeometry *geom, *buffer; <br>
GEOSContextHandle_t handle; <br>
GEOSWKTReader *reader; <br>
GEOSWKTWriter *writer; <br>
char *wkt; <br>
<br>
handle = initGEOS_r(NULL, NULL); <br>
<br>
reader = GEOSWKTReader_create_r(handle); <br>
writer = GEOSWKTWriter_create_r(handle); <br>
<br>
geom = GEOSWKTReader_read_r(handle, reader,
"GEOMETRYCOLLECTION(POINT(1 1), LINESTRING(1 1, 2 2, 4 4, 5
5))"); <br>
<br>
GEOSWKTWriter_setRoundingPrecision_r(handle, writer, 3); <br>
GEOSWKTWriter_setTrim_r(handle, writer, FALSE); <br>
buffer = GEOSBuffer_r(handle, geom, 1, 8); <br>
wkt = GEOSWKTWriter_write_r(handle, writer, buffer); <br>
printf("Buffer: %s\n", wkt); <br>
<br>
return 0; <br>
} <br>
</div>
<pre class="moz-signature" cols="72">--
Alex
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://bit.ly/geodb">http://bit.ly/geodb</a></pre>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
geos-devel mailing list
<a class="moz-txt-link-abbreviated" href="mailto:geos-devel@lists.osgeo.org">geos-devel@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/geos-devel">http://lists.osgeo.org/mailman/listinfo/geos-devel</a></pre>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">--
Alex
<a class="moz-txt-link-freetext" href="http://bit.ly/geodb">http://bit.ly/geodb</a></pre>
</body>
</html>