views:

70

answers:

1

I have a poly-line-contour consisting of line segments and arcs of circles which i want to extrude to prisms.

As my extrusion functions only support straight-edge polygons, i need to approximate the arcs using line segments.

The arcs are defined through a starting point, center point and sweep angle (CCW).

The sweep-angles i need to display range from <10° to 179.9° with radii ranging from .3 mm to 300 mm.

I currently calculate a number of arc-vertices to calculate on and add these to my Polygon in a primitve way: i just put a vertex on every mm of a given arc's length. While this works, it seem to be very inefficient for arcs with large radius and small sweeping angle.

There must be an algorithm which generates good approximatios for all kinds of arcs. If there is, I'd like to know some keywords to narrow down my googling.

+2  A: 

If an arc has sweep angle a, radius r, then the greatest distance between the chord with the same endpoints and the arc is r*(1-cos(a/2). If you subdivide this arc by putting n equally spaced points along it, then the maximum distance between the arc and the segmented line will be r*(1-cos(a/(2*(n+1)))).

So if you want to keep the greatest distance below E, say, then you could put n new points along the arc, with n chosen so that n+1 >= a/(2*acos(1 - E/r))

dmuir
I think E/r could be a better choice for "goodness" than E.
belisarius