# Unit Vectors and Angles

In my job, I work with a ton of unit vectors. While tracking things in three dimensions can be tricky, it helps to start breaking down as many aspects of the dimensions to their base components. I’m sure we’re all familiar with common spatial axis labeling. You get `X`

, `Y`

, and `Z`

. Their application isn’t uniform. Some machine uses `X`

for the vertical axis, some might use `Z`

. What you might not yet be familiar with would be the orientations of objects in space. Yes, you can track the cartesian coordinates rather handily with `XYZ`

, but that will only tell you the position of those objects. It won’t tell you the direction they’re facing, and for that we use unit vectors labeled `IJK`

. They’re typically values between `-1`

and `1`

, and they can define rotation completely.

There are times when you might need to calculate an angle from a unit vector. In those instances, you’re going to need the two unit vector values you’re concerned with. Let’s say hypothetically we have an angle we’re calculating and our two unit vector values are `0.5402`

and `0.8415`

. This brings us to:

$$\frac{\arctan(0.8415, 0.5402) \times 180}{\pi}$$

You should get a result of roughly `32.7`

. Neato. Of course, you can go in the other direction easily as well.

$$\sin(32.7)$$ and $$\cos(32.7)$$

It’s a pretty damn cool party trick, for sure. It actually has a few strong niche use cases, though. Especially in robotics.