[Closed] divide a circle or ellipse into same length segments
Hi There,
I got this math problem to figure out. I want to draw an ellipse or circle based on a and b (horizontal, vertical radius), but the segments from the shape is built must have same length.
I figured that I build only one quarter and then juts mirror the coordinates to get the rest.
Used the ellipse equation and I able to draw an ellipse. However I don’t know the math for getting the right angle for my system to output the proper coords for the segments wich will have similar lenghts.
Probably there is an other way too, in any case it must be angle based
Thanks,
a=10 -- horizontal radius
b=15 -- vertical radius
r = 2*PI/4 -- quarter of the sphere or ellipse in radians.
s = 10-- Number of segments.
v = r /s -- v is the radian for one segment
for i=1 to s do (
q=v*i
q = radtodeg q -- convert actual segment * (radian / segment) into angles
cc = point()
cc.pos = [a*cos(q)*100, b*sin(q)*100, 0] -- caculate the coords. the 100 is just a multiplier to have it bigger in the viewport
cc.size = 20
)
well, after trying out several methods I made an algorithm to correct the segments size based on sinus(angle) and the Major and minor axis. This created relatively ok result. Anyway I used maxscript as a test platform, so the code is now translated into PHP.