java - creating polygons based on intersection -


say have 2 polygons, , b.
polygon has points @ (0,0), (0, 5), , (5, 0)
polygon b has points @ (-2, 2), (5, 5), , (5, 2)
goal split in 3 different polygons
polygon 1 polygon - intersects polygon b
polygon 2 polygon b - intersects polygon a
polygon 3 intersection area.
polygons 1 , 2, use java's geom.area.intersect method.
how go creating polygon 3?

polygons 1, 2 , 3 same thing. :-)

you can area gamma using intersect().

then can subtract() area gamma polygon area alpha (the part of that's outside gamma), , subtract() gamma b beta (the part of b that's outside gamma).

to convert area polygon, collect vertex points each area using getpathiterator(null), feed them polygon constructor.


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -