]> granicus.if.org Git - postgis/commitdiff
Add ptarray_isclosed3d function
authorOlivier Courtin <olivier.courtin@camptocamp.com>
Thu, 22 Oct 2009 14:06:45 +0000 (14:06 +0000)
committerOlivier Courtin <olivier.courtin@camptocamp.com>
Thu, 22 Oct 2009 14:06:45 +0000 (14:06 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@4670 b70326c6-7e19-0410-871a-916f4a2858ee

liblwgeom/liblwgeom.h
liblwgeom/ptarray.c

index b570fff7e72d732fedbd241e895c961e7f028d35..41eb0c198cc6032c9f37ba161329485688588f1f 100644 (file)
@@ -1372,6 +1372,7 @@ extern POINTARRAY *ptarray_addPoint(POINTARRAY *pa, uchar *p, size_t pdims,
 extern POINTARRAY *ptarray_removePoint(POINTARRAY *pa, unsigned int where);
 
 extern int ptarray_isclosed2d(const POINTARRAY *pa);
+extern int ptarray_isclosed3d(const POINTARRAY *pa);
 
 extern void ptarray_longitude_shift(POINTARRAY *pa);
 
index 2e0eed56afb89a2ef56f74ad1fd21bbc4c9d7217..f478eb3aaec8ba12b620e4a872794cdf7ee459de 100644 (file)
@@ -378,6 +378,13 @@ ptarray_isclosed2d(const POINTARRAY *in)
        return 1;
 }
 
+int
+ptarray_isclosed3d(const POINTARRAY *in)
+{
+       if ( memcmp(getPoint_internal(in, 0), getPoint_internal(in, in->npoints-1), sizeof(POINT3D)) ) return 0;
+       return 1;
+}
+
 /**
  * @brief calculate the #BOX3D bounding box of a set of points
  * @return  a lwalloced #BOX3D, or NULL on empty array.