2021年3月20日星期六

Java: How to tell if a polygon is inside another polygon?

In Java, how do I tell if a Polygon is contained within another Bounded Polygon? Eg Pentagon within Triangle, Rectangle within Hexagon, given user provides all the vertices coordinates. In Python they have Shapely library, curious tabout olution in Java, without using processBuilder and not using Python to Java communication ? Open to using OpenCV in Java however

Image Sample

https://stackoverflow.com/a/55840998/15435022

Python:

from shapely.geometry import Polygon  polya = Polygon([(0, 0), (0, 1), (1, 1), (1, 0)])   polyb = Polygon([(0.5, 0.5), (0.5, 0.8), (0.8, 0.8), (0.8, 0.5)])   polya.contains(polyb)  # True  
https://stackoverflow.com/questions/66727945/java-how-to-tell-if-a-polygon-is-inside-another-polygon March 21, 2021 at 09:04AM

没有评论:

发表评论