algorithm - To pixelate geometric primitives -
algorithm - To pixelate geometric primitives -
it necessary have matrix representation of set of geometric primitives (i.e., line, curve, circle, rectangle, filled forms). simplicity may suppose dealing lines, reply on [so]. rectangles hence pixelated. rest of primitives 2 questions appear me:
1) how pixelate curve including circle (~closed curve)? 2) how pixelate filled simple / complex shape (rectangle, multi-patch)?
the simplest way (currently in use) may utilizing visualizing library (such matplotlib
python
) save result (a map of geometric primitives) pixelated image on disk (or ram) , reuse purpose of interest. apparently, method can handle complexity since in background whatever (the visualizer) output 2d image
, i.e., 2d matrix
. serious problems emerge in application:
1) procedure slow! 2) procedure not standard heavily dependent setting of visualizer, low-level configuration impossible or hard set visualizer. in other words, black box beingness used lacks controlling on procedure required.
what doing called "scan conversion" of geometric primitives.
for line segments, know the bresenham algorithm.
there similar 1 circles, bit trickier (as regards handling of endpoints).
general curves broader topic. can think of conics, splines or hand-drawn. 1 approach approximate them polyline.
to fill polygons, there scanline algorithm available (consider sweeping horizontal line , fill between intersections polygon outline).
to fill arbitrary shapes, alternative draw outline , utilize seed filling (from given internal point).
you find relevant material @ http://www.cse.ohio-state.edu/~gurari/course/cis681/cis681ch5.html
algorithm pixel computational-geometry
Comments
Post a Comment