How do we convert a direction vector to an angle?

Plain_Dude_Sleeping_Alone :

If I have a vector v1(-4,3) where it starts from v0(0,0). How do I find out the direction in said, in angle or radian representation ?. The magnitude of the vector is sqrt((-4-0)^2 + (3-0)^2) which is 5. If the direction is (|-4/5|, |3/5| ) which is (0.8, 0.6) then how do I convert this in an angle representation? Will this be clockwise, counter-clockwise?

duffymo :

The fastest way to answer this question is to experiment:

public class TangentDemo {

    public static void main(String[] args) {
        double x = -4.0;
        double y = 3.0;
        double radians = Math.atan2(y, x);
        System.out.println(String.format("Angle: %10.6f radians %10.6f degrees", radians, Math.toDegrees(radians)));
    }
}

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=291102&siteId=1