Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] 2D polygon offsetting and Circular Arc Subdivision

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] 2D polygon offsetting and Circular Arc Subdivision


Chronological Thread 
  • From: Louis Lavery <>
  • To:
  • Subject: Re: [cgal-discuss] 2D polygon offsetting and Circular Arc Subdivision
  • Date: Sat, 10 May 2008 12:41:40 +0100

Marko Kukovec wrote:
Hello!

About a week ago I put a question on this mailing list about
offsetting/insetting 2D polygons in CGAL. I have a problem as I have a
polygons with arcs and lines so I can't directly feed the
offsetting/insetting algorithm. I got an answer from Fernando Cacciola
and he suggested I should polygonize all arcs prior to feeding the
offsetting algorithm. He even pointed out this algorithm
http://www.worldserver.com/turk/computergraphics/CircularArcSubdivision.pdf .

If you have an arc not more than 90 degrees, of radius r,
centred on the origin with start point s and end point e
then the point m = (s+e)/2 is mid way between s and e
and its distance from the arc is r-length(m).

So it should be possible to adapt this...

OutIter varc(Vector const s,Vector const e,double const r,
double const delta,OutIter res)
{
Vector m = (s+e)/2;

double const l = length(m);

if (r-l > delta)
{
m *= r/l;

res = varc(s,m,r,delta,res);

*res = m;
++res;

res = varc(m,e,r,delta,res);
}

return res;
}

...to vector a general arc.

HTH, Louis.




Archive powered by MHonArc 2.6.16.

Top of Page