/** Returns the angle from this point to another one.
Taking this point to be the centre of a circle, and the other point being a position on
the circumference, the return value is the number of radians clockwise from the 12 o'clock
direction.
So 12 o'clock = 0, 3 o'clock = Pi/2, 6 o'clock = Pi, 9 o'clock = -Pi/2
*/
FloatType getAngleToPoint (Point other) const noexcept
{
return static_cast<FloatType> (std::atan2 (static_cast<FloatType> (other.x - x),
static_cast<FloatType> (y - other.y)));
}
It’s intended that way. In math you usually use the x axis for an angle of zero, y for pi/2 and so on. However, JUCE chose another convention which is perfectly fine. Especially as it is documented
It depends what coordinate system you’re working with. Points are usually associated with positions of things you are drawing to the screen, and getAngleToPoint would work as expected if you were calculating an angle between two Points in a paint() callback.
If you were drawing that to the screen using Lines then that would you give the correct answer - your start and end points (in screen positions) would be something like (5, 1.2), (8, 3.86).
Or, if you wanted to use that function with regular Cartesian axes you can simply flip the y-axis of all your points. So rather than 0 -> 4 you go 0 -> -4 (but you can still treat it as positive when you’re drawing it on paper).