Close

Slices of Pie

A project log for Occifer Bob Watcher

Vehicle-mounted camera with panoramic lens to look for emergency services and other vehicular lights.

glebiteglebite 10/08/2014 at 14:260 Comments

Pie slice bitmasks are doable as per my previous post.

These were generated in Tcl using the canvas and then exporting to postcript and then PNG. In reality, the bitmaps are planned to be loaded as BLOBs which will be generated if there's a change in the resolution of the acquired images.

What I've done is implemented Bresenham's algorithm for arcs and lines, recording each of the plotted points in an array. If given an arc with radius (r), and lines (v0 and v1) defined by an angle (in degrees), then the pie slice is generated by:

horizontal line from v0(x,y) of length v1(x',y) - v0(x,y) where v1(x',y) exists, or a(x'',y) - v0(x,y) instead.

It's fast. It works on one quadrant but the other quadrants can be generated by reflections in x and y and x/y axis...

Discussions