[prev in list] [next in list] [prev in thread] [next in thread] 

List:       postgis-users
Subject:    Re: [postgis-users] function to check if a polygon is convex
From:       Martin Davis <mtnclimb () gmail ! com>
Date:       2022-03-02 22:03:34
Message-ID: CAK2ens10XDLazBc45rW9moJPiRTBmiGLVm=NzkPctdQY8oa-PA () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Yes, that's a way to check if a polygon is convex.  Not the most efficient,
but currently there's no more direct way (pretty sure).

On Wed, Mar 2, 2022 at 1:38 PM B H <hemantbist@gmail.com> wrote:

> 
> select st_equals(st_convexhull(wkb_geometry), wkb_geometry) is true  for
> all st_isvalid convex polygons I tried on).
> Is this a correct way to check for convexity of the polygon?
> 
> 
> On Wed, Mar 2, 2022 at 1:15 PM B H <hemantbist@gmail.com> wrote:
> 
> > Hi,
> > How do I check if the polygon is convex in postgis?
> > 
> > Things I have tried before sending this email
> > I could not find any function  like st_is_convex.
> > I searched in google but  I could not find any user defined postgres
> > function to check for convexity of polygon either.
> > select st_convexhull(wkb_geometry) = wkb_geometry  -- this returns false
> > for convex polygons also.
> > 
> > Other libraries e.g. CGAL seem to have it. So I am hoping that something
> > is already available in postgis that I am missing.
> > 
> > https://doc.cgal.org/Manual/3.1/doc_html/cgal_manual/Partition_2_ref/Function_convex_partition_is_valid_2.html
> >  Best,
> > HB
> > 
> _______________________________________________
> postgis-users mailing list
> postgis-users@lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/postgis-users
> 


[Attachment #5 (text/html)]

<div dir="ltr"><div>Yes, that&#39;s a way to check if a polygon is convex.   Not the \
most efficient, but currently there&#39;s no more direct way (pretty \
sure).</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, \
Mar 2, 2022 at 1:38 PM B H &lt;<a \
href="mailto:hemantbist@gmail.com">hemantbist@gmail.com</a>&gt; \
wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div \
dir="ltr"><div><br></div>select st_equals(st_convexhull(wkb_geometry),  wkb_geometry) \
is true   for all st_isvalid convex polygons I tried on).<div>Is this a correct way \
to check for convexity of the polygon?<br><div><br></div></div></div><br><div \
class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Mar 2, 2022 at 1:15 PM \
B H &lt;<a href="mailto:hemantbist@gmail.com" \
target="_blank">hemantbist@gmail.com</a>&gt; wrote:<br></div><blockquote \
class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid \
rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi,<div>How do I check if the \
polygon  is convex in postgis?</div><div><br></div><div>Things I have tried before \
sending this email</div><div>  I could not find any function   like \
st_is_convex.</div><div>I searched in google but   I could not find any user defined \
postgres function  to check for convexity of polygon either.</div><div>select \
st_convexhull(wkb_geometry) = wkb_geometry   -- this returns false for convex \
polygons also.<br></div><div><br></div><div>Other  libraries e.g. CGAL seem to have \
it. So I am hoping that something is already available in postgis that I am \
missing.</div><div><a \
href="https://doc.cgal.org/Manual/3.1/doc_html/cgal_manual/Partition_2_ref/Function_convex_partition_is_valid_2.html" \
target="_blank">https://doc.cgal.org/Manual/3.1/doc_html/cgal_manual/Partition_2_ref/F \
unction_convex_partition_is_valid_2.html</a><br></div><div>Best,</div><div>HB</div></div>
 </blockquote></div>
_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@lists.osgeo.org" \
target="_blank">postgis-users@lists.osgeo.org</a><br> <a \
href="https://lists.osgeo.org/mailman/listinfo/postgis-users" rel="noreferrer" \
target="_blank">https://lists.osgeo.org/mailman/listinfo/postgis-users</a><br> \
</blockquote></div></div>



_______________________________________________
postgis-users mailing list
postgis-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/postgis-users


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic