java - Path2D.intersect() Similar to Area.intersect() -


i have played around area.intersect() , wondering if there way create method 1 using path2d because noticed performance jump when using path2d shape. in other words take portion of large path2d , create smaller path2d portion.

map drawing mapdraw in-game view in-game

note: using below hashmap render tiled shapes viewing area according each "object" in case different image types : ocean, grass, obsidian, rock, sand, & dirt...

linkedhashmap<point, linkedhashmap<object, path2d.double>> 

edit : each image type has entire map area of own 10000px 100000px tiles intersect 100px 100px shoved linked hash map point given type path2d.double , rendered onto screen points in current viewing area.

it's not clear sdk you're working offers area.intersect(). depanding on intend intersect path with, however, may complex problem - notice path2d intersected polygon may turn several paths!

however, there known algorithm intersecting path polygon, such cyrus-beck or sutherland-cohen.

i found piece of code cohen-sutherland in java:

http://worldofenggcodes.blogspot.co.il/2013/10/cohen-sutherland-line-clipping-algorithm.html

which seems ok, although might need extract code more usable function. cyrus-beck better option, though find pseudo-code:

http://www.moreprocess.com/computer-graphics/cyrus-beck-line-clipping-algorithm

once you've implemented either, need apply every line in path, new list of lines intersect square.


Comments

Popular posts from this blog

php - render data via PDO::FETCH_FUNC vs loop -

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

The canvas has been tainted by cross-origin data in chrome only -