How is polygon intersection determined?

  • dezzroy

    dezzroy - 2013-09-28

    Hi, I've just started to check out javaGeom, and after a quick look, I didn't find an intersects() method for SimplePolygon2D.

    I did see that Polygons2D has an intersection() method. Perhaps this would return null or a degenerate Polygon2D if the arguments don't intersect?

    What's the best way to determine if two polygons intersect?

  • David Legland

    David Legland - 2013-10-03

    Hi dezzroy,

    there are functions to compute the result of the intersection between two polygons, but there is no test function that returns a boolean result.

    So you were right, one way to detects if two polygons intersect is to use the isEmpty() methods, that will tell you if the result of the operation contains a polygon or not.

    I hope this answer your question ?


    Last edit: David Legland 2013-10-03
  • dezzroy

    dezzroy - 2013-10-06

    Yes, I understand, thanks.


Log in to post a comment.