[postgis-users] function to check if a polygon is convex
Martin Davis
mtnclimb at gmail.com
Wed Mar 2 14:03:34 PST 2022
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 at 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 at 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 at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/postgis-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20220302/35a239fe/attachment.html>
More information about the postgis-users
mailing list