Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jts-dev] Visual Center of Polygon

Yes,  polygon.equals(polygon.convexHull()) should work for checking convexity, but testing interior angles should be a lot faster.

On Wed, Oct 24, 2018 at 9:58 AM Eric Angle <eric.lohner.angle@xxxxxxxxx> wrote:
Thank you Martin, this is very helpful. At first glance PolyLabeller.getPolyLabel() appears to be exactly what I'm looking for.

Your suggestion of checking that all interior angles are less than 180 makes sense to me.

I assume you agree polygon.equals(polygon.convexHull()) should work, and your suggestion to check the interior angles just might be faster?

Eric Angle

On Wed, Oct 24, 2018 at 10:33 AM Martin Davis <mtnclimb@xxxxxxxxx> wrote:
if there is agreement that it is correct that  convex == all interior angles convex, it would be nice to add that as an isConvex method to the ConvexHull class.

On Wed, Oct 24, 2018 at 9:25 AM Martin Davis <mtnclimb@xxxxxxxxx> wrote:
Good question.  Perhaps test that every interior angle is convex?

On Wed, Oct 24, 2018 at 9:23 AM Eric Angle <eric.lohner.angle@xxxxxxxxx> wrote:
I had a follow up question. Is there a better way to determine if a Polygon is convex than checking polygon.equals(polygon.convexHull()) ?

Thank you,

Eric Angle

On Wed, Oct 24, 2018 at 9:43 AM Eric Angle <eric.lohner.angle@xxxxxxxxx> wrote:
I'm interested in calculating the visual center of a JTS Polygon. If the Polygon is convex, then the getCentroid() method works great. However, if the Polygon is non-convex, getCentroid() can return a Point outside the Polygon. Polygon does have a getInteriorPoint() method, however it doesn't always return what I would consider the visual center.

Is there any capability within JTS to calculate the visual center of a Polygon?

Some Googling suggests that I could triangulate the polygon (which JTS can definitely do) and then somehow use that to calculate the visual center (pole of inaccessibility and skeleton algorithms are terms that pop up).

Thank you for any input you can provide.

Eric Angle
_______________________________________________
jts-dev mailing list
jts-dev@xxxxxxxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.locationtech.org/mailman/listinfo/jts-dev
_______________________________________________
jts-dev mailing list
jts-dev@xxxxxxxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.locationtech.org/mailman/listinfo/jts-dev
_______________________________________________
jts-dev mailing list
jts-dev@xxxxxxxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.locationtech.org/mailman/listinfo/jts-dev

Back to the top