From: David Blasby Date: Thu, 10 Apr 2003 19:16:43 +0000 (+0000) Subject: changes to area() X-Git-Tag: pgis_0_8_0~112 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e83f29638620c86eda357ebb854654150204d76d;p=postgis changes to area() git-svn-id: http://svn.osgeo.org/postgis/trunk@270 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/postgis_fn.c b/postgis_fn.c index 7621f2c59..62f5c3ef0 100644 --- a/postgis_fn.c +++ b/postgis_fn.c @@ -185,21 +185,22 @@ double polygon_area2d_old(POLYGON3D *poly1) 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 diff --git a/postgis_geos.c b/postgis_geos.c index 5db499745..166bac902 100644 --- a/postgis_geos.c +++ b/postgis_geos.c @@ -1,55 +1,4 @@ -/* -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); -*/ + //-------------------------------------------------------------------------- //