Refreshing grade school math.

Giganews Newsgroups
Subject: Refreshing grade school math.
Posted by:  Jonas_Thörnvall
Date: Wed, 8 Jan 2020

I decided to try make a function to draw a circle "polygon" without angles.=
But i have completly forgotten howto evenly distribute the cordinates with=
out using sin cosin angle.

Below is the circle/polygon divided into four quadrants and arched. But it =
does not create a regular polygon. Simple fact my math skills lacking. Befo=
re i decided to graph equation, i first did try solve the cordinates using =
purely geometric approach. No angles just finding cross sections of shape, =
couldn't do it.

But maybe someone with a little more math insight have an idea howto create=
regular polygons without cosin and sin angle?

Distance is "sort of" vertex distance but it is not regular.

function circle(){
translateX=3D800;
translateY=3D450;
radius=3D400;
x=3D400;
distance=3D150;
arclength=3D280;
//x*x+y*y=3D400*400  solve y
for (x=3D-arclength;x<=3Darclength;x=3Dx+distance){
ysquare=3D(radius*radius)-(x*x);
y=3DMath.sqrt(ysquare);
if(x=3D=3D-arclength){savex=3Dx;savey=3Dy;}
ctx.fillStyle=3D"black";
ctx.lineTo(x+translateX,y+translateY);
//ctx.fillRect(x+translateX,y+translateY,4,4);=20
}
for (y=3Darclength;y>=3D-arclength;y=3Dy-distance){
xsquare=3D(radius*radius)-(y*y);
x=3DMath.sqrt(xsquare);
ctx.lineTo(x+translateX,y+translateY);
//ctx.fillRect(x+translateX,y+translateY,3,3);=20
}
for (x=3Darclength;x>=3D-arclength;x=3Dx-distance){
ysquare=3D(radius*radius)-(x*x);
y=3DMath.sqrt(ysquare);
ctx.lineTo(x+translateX,-y+translateY);
//ctx.fillRect(x+translateX,-y+translateY,3,3);=20
}
for (y=3D-arclength;y<=3Darclength;y=3Dy+distance){
xsquare=3D(radius*radius)-(y*y);
x=3DMath.sqrt(xsquare);
ctx.lineTo(-x+translateX,y+translateY);
//ctx.fillRect(-x+translateX,y+translateY,3,3);=20
}
ctx.lineTo(savex+translateX,savey+translateY);
ctx.fillStyle=3D"yellow";
ctx.stroke();
}

Replies