From f97acc13d3eb631285cb8430fbffe7b59dc6474b Mon Sep 17 00:00:00 2001 From: Olivier Courtin Date: Thu, 22 Oct 2009 14:06:45 +0000 Subject: [PATCH] Add ptarray_isclosed3d function git-svn-id: http://svn.osgeo.org/postgis/trunk@4670 b70326c6-7e19-0410-871a-916f4a2858ee --- liblwgeom/liblwgeom.h | 1 + liblwgeom/ptarray.c | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/liblwgeom/liblwgeom.h b/liblwgeom/liblwgeom.h index b570fff7e..41eb0c198 100644 --- a/liblwgeom/liblwgeom.h +++ b/liblwgeom/liblwgeom.h @@ -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); diff --git a/liblwgeom/ptarray.c b/liblwgeom/ptarray.c index 2e0eed56a..f478eb3aa 100644 --- a/liblwgeom/ptarray.c +++ b/liblwgeom/ptarray.c @@ -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. -- 2.50.1