# Rotation of two vectors

**URL:** https://discourse.vtk.org/t/rotation-of-two-vectors/5858
**Category:** Support
**Tags:** proposal, file-formats
**Created:** [May 25, 2021, 6:04am UTC](https://discourse.vtk.org/t/rotation-of-two-vectors/5858 "2021-05-25T06:04:29Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Koly](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/k/a3d4f5/32.png) [@Koly](https://discourse.vtk.org/u/Koly)
#### Post date: [May 25, 2021, 6:04am UTC](https://discourse.vtk.org/t/rotation-of-two-vectors/5858/1 "2021-05-25T06:04:29Z")

</div>

Given two three-dimensional unit vectors A and B, calculate the rotation angle (including the order) from A to B.

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [May 25, 2021, 9:54pm UTC](https://discourse.vtk.org/t/rotation-of-two-vectors/5858/2 "2021-05-25T21:54:16Z")

</div>

Hi, Koly,

If I understood right, you need the angle between the vectors at the origin:  
 ![image](https://discourse.vtk.org/uploads/default/original/2X/4/4a8f89d3f03806e4f92727dea612f31478fcd029.png)  
The angle θ can be simply calculated with: θ = acos[(u.v) / (|u||v|)]. _acos()_ is the arc-cosine function. u.v is the dot product between the two vectors. |u||v| is the product between the lengths of both vectors.

If this is not what you want, you need to state your problem with further details.

cheers,

Paulo
