Saturday, 15 February 2014

performance - Rasterize polygons on GPU for hit-testing -



performance - Rasterize polygons on GPU for hit-testing -

task

perform many hit-tests on polygons. have 10,000 polygons 1,000 points each. 100,000,000 hit-tests performed against these polygons. polygons may touch each other never overlap.

solution

simple point-in-polygon test every hit-test.

problem

far slow.

improvement

rasterize polygons , check polygon pixel of hit-tests belongs to.

new problem

rasterization of polygons slow. i'm using algorithm: http://alienryderflex.com/polygon_fill/

idea

rasterize polygons on gpu since it's optimized task , can perform in hardware.

question

what think thought , can give me advice start? lead high performance?

sidenote

the area sparsly covered polygons. want maintain list of pixels instead of bitmap.

this reply suggests utilize gpu if can: point in polygon aka nail test

your case seems dominated nail tests, o(1) rasterization. gpus able rasterize memory, not aware of gpu / rendering api able work list of points. also, list of points, may lose o(1) runtime nail check. may able save memory using 16 bit raster buffer (not sure if that's feasible gpu setup -- seem need 10000 colors).

performance algorithm gpu polygon raster

No comments:

Post a Comment