I know what Sine and Cosine are (mostly).
Sine = opposite / hypotonuse(sp?)
Cosine = adjacent /hypotonuse(sp?)
But since I have no clue how to apply that to circles, I used Seph's Ring Menu Customizable script as a reference.
Will the following have any chance of working as I hope it to? If it does, I'll use it for lots of stuff lol.
class Circle_Reference
def initialize(x,y,diameter)
@x = x
@y = y
@diameter = diameter
@radius = @diameter / 2
@circumference = (@diameter * Math::PI).floor
end
def find_point(percentage)
d1 = 2.0 * Math::PI / @circumference
d2 = d1 / @circumference
temp = @circumference * percentage.floor
for i in 0...@circumference
if i == temp
j = i - temp + 1
d = d1 * j + d2 * @steps
x = (@x + @radius) + ( @radius * Math.sin( d ) ).to_i
y = (@y + @radius) - ( @radius * Math.cos( d ) ).to_i
return [x,y]
end
end
end
end
EDIT : Let me rephrase this, how the heck do I do something like this? I just need to know the math portion, I'll figure the rest out. As I said before, all I need to know is how to find a point on a circle using Sine and Cosine.
r - radius
x - coordinate on the x-axis
y - coordinate on the y-axis
fi - angle (in radians)
x = r * Math.cos(fi)
y = r * Math.sin(fi)
Don´t forget to set offset of the "zero-zero" point.
i.e. offset_x = offset_y = r
In that case you need to use something like
x_coord = offset_x - x
y_coord = offset_y - y
Thanks, I guess my problem now is understanding what Radians are. I've heard of them, but while I'm in the top percentile of my class, I don't know everything lol.
PS: Holy Cr*p, That's amazing. *refering to pm* Gah, having urge to finish highschool and go to college already.
I´m glad you like the file, lol.
Radians are similar to degrees. But instead of i.e. 180 degrees you have 1 * PI. 360 is 2 * PI, while i.e. 45 degrees is PI/4 in radians. It´s not REALLY complex, it just seems so.