Answer the question
In order to leave comments, you need to log in
How to find the angle between points on the "almost unit circle"?
There is a space 500x500, with the center O(250, 250)
There is a point А(112,392)
Length AO = 198
How to find the angle a ?
This formula always returns an angle between 0 and 90:
class Vector
{
dX()
{
return Math.abs( this.points[1].x - this.points[0].x );
}
dY()
{
return Math.abs( this.points[1].y - this.points[0].y );
}
getAngle()
{
var Anlge = Math.atan2( this.dY(), this.dX() ) / Math.PI * 180;
return (Anlge < 0) ? Anlge + 360 : Anlge;
}
}
Answer the question
In order to leave comments, you need to log in
Found the problem. If anyone needs:
class Vector
{
dX()
{
return this.points[1].x - this.points[0].x;
}
dY()
{
return this.points[1].y - this.points[0].y;
}
getAngle()
{
var Anlge = Math.atan2( this.dY(), this.dX() ) / Math.PI * 180;
return (Anlge < 0) ? Anlge + 360 : Anlge;
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question