Reputation: 3
I am going to draw a shape like a gear, how can I move a tooth around a circle? Something like the image below : circle
For example, I need to draw 20 teeth at equal intervals around a circle with a diameter of 50 mm. I am doing this for a G-code generator program I draw a tooth first ,Then it is necessary to draw these teeth, which can be adjusted to the desired number by the user, according to the diameter of the gear wheel around a circle For example, this is a G-code for drawing one tooth :
G90
G21
G1 X0 Y0
G1 X5 Y10
G1 X10 Y10
G1 X15 Y0
You can view the output using this site : https://ncviewer.com/
What is the equation to do this? I am currently programming using Lua language
Upvotes: 0
Views: 57
Reputation: 1908
n equidistant points on a circle of radius r can be defined (in radians) by
theta = 2pi/n
(x_i, y_i) = (r*cos(i*theta), r*sin(i*theta))
for 0 <= i < n. In degrees, the equivalent would be
theta = 360/n
(x_i, y_i) = (r*cos(i*theta), r*sin(i*theta))
Upvotes: 0