Try d=Pai/4
I mean Pai=3.14...........
The sin() function doesn't accept normal degree inputs.
Pai is equivalent to 180 degree.
Hello,
I have made this "code" to rotate a point about another point, which stays at it's own place (notice that this is programmed, so: Math.sqrt is the square root, Math.sin is sinus etc.) :
But this doesn't work properly: The point DOES rotate, and in a good circle with a radius equal to "distance", but it doesn't rotate 45 degrees, but much more. I hope i've been clear to you all, because i'm not English :Pd = 45;
xdistance = x2 - x;
ydistance = y2 - y;
distance = Math.sqrt(xdistance*xdistance+ydistance*ydistance) ;
y = y2+distance*Math.sin(d);
x = x2+distance*Math.cos(d);
variables:
d is the amount of rotation in degrees
x is the x coordinate of the point to be rotated
y is the y coordinate of the point to be rotated
x2 is the x coordinate of the axis
y2 is the y coordinate of the axis
distance is the distance between point 1 and point 2
Thanx in advance,
Jürgen