Ok, I removed my closed voice, your question is a little different from the ones I am related to
- but as you can see not much :)
We played with my code a bit, so here is the result for equidistant points
void draw()
{
TCanvas *scr=Form1->Canvas;
scr->Brush->Color=clWhite;
scr->Rectangle(0,0,Form1->ClientWidth,Form1->ClientHeight);
double x0,y0,rx,ry,n,l0,ll0;
x0=Form1->ClientWidth>>1;
y0=Form1->ClientHeight>>1;
rx=200;
ry=50;
n=33.0;
l0=(rx-ry)/(rx+ry); l0*=3.0*l0; l0=M_PI*(rx+ry)*(1.0+(l0/(10.0+sqrt(4.0-l0))));
l0/=n; ll0=l0*l0;
int i,j,k,kd;
AnsiString s;
double a,da,x,y,xx,yy,ll,mm,r=2.0;
for (kd=10,k=0;;k++)
{
a=0.0; if (!k) da=0.0;
xx=rx*sin(a+0.5*da);
yy=ry*cos(a+0.5*da);
da=l0/sqrt((xx*xx)+(yy*yy));
x=x0+rx*cos(a);
y=y0+ry*sin(a);
if (k==kd)
{
scr->Pen->Color=clRed;
scr->MoveTo(x ,y );
scr->LineTo(x0,y0);
scr->Ellipse(x-r,y-r,x+r,y+r);
scr->Pen->Color=clBlue;
scr->Font->Color=clBlue;
}
for (i=n;i>0;i--)
{
xx=rx*sin(a+0.5*da);
yy=ry*cos(a+0.5*da);
da=l0/sqrt((xx*xx)+(yy*yy));
xx=x; yy=y; a+=da;
x=x0+rx*cos(a);
y=y0+ry*sin(a);
ll=((xx-x)*(xx-x))+((yy-y)*(yy-y)); ll=fabs(ll0-ll);
for (da*=0.1,a-=da,j=0;j<5;)
{
a+=da;
x=x0+rx*cos(a);
y=y0+ry*sin(a);
mm=((xx-x)*(xx-x))+((yy-y)*(yy-y)); mm=fabs(ll0-mm);
if (mm>ll) { a-=da; da=-0.1*da; j++; } else ll=mm;
}
x=x0+rx*cos(a);
y=y0+ry*sin(a);
if (k==kd)
{
scr->MoveTo(xx,yy);
scr->LineTo(x ,y );
scr->Ellipse(x-r,y-r,x+r,y+r);
ll=((xx-x)*(xx-x))+((yy-y)*(yy-y));
s=AnsiString().sprintf("%.2lf",ll0-ll);
xx=0.5*(x+xx)+20.0*cos(a)-0.5*double(scr->TextWidth(s));
yy=0.5*(y+yy)+20.0*sin(a)-0.5*double(scr->TextHeight(s));
scr->TextOutA(xx,yy,s);
}
}
if (k==kd)
{
scr->MoveTo(x ,y );
scr->LineTo(x0,y0);
s=AnsiString().sprintf("%.4lf",2.0*M_PI-a);
xx=x+60.0*cos(a)-0.5*double(scr->TextWidth(s));
yy=y+60.0*sin(a)-0.5*double(scr->TextHeight(s));
scr->TextOutA(xx,yy,s);
break;
}
a=2.0*M_PI/a;
l0*=0.5+0.5*a;
ll0=l0*l0;
}
}
It consists of code from a second linked Q / A , but in any case this is what it does
k/kdthe loop completes all kd-times
, l0,ll0. ... , . rx=4.0*ry ( ). , kd=1,2 or 3
i
Q/A, l0 'j'
j
, , 10 , , j,
k/kd
2*PI, , l0, , , l0
