The positive value of Math.sin (x) x. The return value is between 1.0 and 1.0;
The cosine of the Math.Cos (x) x. Returns a number from 1.0 to 1.0;
The x in both functions refers to "radian" rather than "angle", and the arc is calculated as: 2*pi/360* angle;
Radian of 30° angle = 2*pi/360*30
How do I get the coordinates of each point on the circle?
Solution idea: According to the triangle of the positive and cosines, the value;
Suppose that the center coordinate of a circle is (a, b), the RADIUS is R,
The x-coordinate of each point on the circle =a + Math.sin (2*math.pi/360) * r; y coordinate =b + math.cos (2*math.pi/360) * r;
How do I ask the clock's second hand to turn the trajectory of a circle?
Assuming the initial value (starting point) of the second hand is 12 o'clock, the coordinate of the center is (a, b).
Solution: A minute is 60 seconds, a circle is 360°, so the average rotation angle per second is 360°/60 = 6°;
for (var times=0; times<60; times++) {
var Hudu = (2*math.pi/360) * 6 * times;
var X = a + Math.sin (hudu) * r;
var y = b-math.cos (hudu) * R//Note here is the "-" number, because the Y we want to get is relative to (0,0).
}
Javascript:Math.sin () cos () usage