pts1 = (POINT3D *) ( (char *)&(poly1->npoints[poly1->nrings] ) );
pts1 = (POINT3D *) MAXALIGN(pts1);
-
+//elog(NOTICE,"in polygon_area2d_old");
pt_offset = 0; //index to first point in ring
for (ring = 0; ring < poly1->nrings; ring++)
{
ringarea = 0.0;
- for (i=0;i<(poly1->npoints[ring]);i++)
- {
- j = (i+1) % (poly1->npoints[ring]);
+ for (i=0;i<(poly1->npoints[ring]-1);i++)
+ {
+ // j = (i+1) % (poly1->npoints[ring]);
+ j = i+1;
ringarea += pts1[pt_offset+ i].x * pts1[pt_offset+j].y - pts1[pt_offset+ i].y * pts1[pt_offset+j].x;
}
ringarea /= 2.0;
-
+//elog(NOTICE," ring 1 has area %lf",ringarea);
ringarea = fabs(ringarea );
if (ring != 0) //outer
ringarea = -1.0*ringarea ; // its a hole
-/*
-drop function geos_thing(geometry,geometry);
-CREATE FUNCTION relate(geometry,geometry)
- RETURNS text
- AS '/data1/Refractions/Projects/PostGIS/work_dave/postgis/libpostgis.so.0.7','relate_full'
- LANGUAGE 'c' with (isstrict);
-
-CREATE FUNCTION relate(geometry,geometry,text)
- RETURNS boolean
- AS '/data1/Refractions/Projects/PostGIS/work_dave/postgis/libpostgis.so.0.7','relate_pattern'
- LANGUAGE 'c' with (isstrict);
-
-CREATE FUNCTION disjoint(geometry,geometry)
- RETURNS boolean
- AS '/data1/Refractions/Projects/PostGIS/work_dave/postgis/libpostgis.so.0.7'
- LANGUAGE 'c' with (isstrict);
-
-CREATE FUNCTION touches(geometry,geometry)
- RETURNS boolean
- AS '/data1/Refractions/Projects/PostGIS/work_dave/postgis/libpostgis.so.0.7'
- LANGUAGE 'c' with (isstrict);
-
-CREATE FUNCTION intersects(geometry,geometry)
- RETURNS boolean
- AS '/data1/Refractions/Projects/PostGIS/work_dave/postgis/libpostgis.so.0.7'
- LANGUAGE 'c' with (isstrict);
-
-CREATE FUNCTION crosses(geometry,geometry)
- RETURNS boolean
- AS '/data1/Refractions/Projects/PostGIS/work_dave/postgis/libpostgis.so.0.7'
- LANGUAGE 'c' with (isstrict);
-
-CREATE FUNCTION within(geometry,geometry)
- RETURNS boolean
- AS '/data1/Refractions/Projects/PostGIS/work_dave/postgis/libpostgis.so.0.7'
- LANGUAGE 'c' with (isstrict);
-
-CREATE FUNCTION contains(geometry,geometry)
- RETURNS boolean
- AS '/data1/Refractions/Projects/PostGIS/work_dave/postgis/libpostgis.so.0.7'
- LANGUAGE 'c' with (isstrict);
-
-CREATE FUNCTION overlaps(geometry,geometry)
- RETURNS boolean
- AS '/data1/Refractions/Projects/PostGIS/work_dave/postgis/libpostgis.so.0.7'
- LANGUAGE 'c' with (isstrict);
-
- CREATE FUNCTION isvalid(geometry)
- RETURNS boolean
- AS '/data1/Refractions/Projects/PostGIS/work_dave/postgis/libpostgis.so.0.7'
- LANGUAGE 'c' with (isstrict);
-*/
+
//--------------------------------------------------------------------------
//