# Calculate axis of rotation

**URL:** <https://discourse.slicer.org/t/calculate-axis-of-rotation/15871>\
**Category:** Support\
**Tags:** registration, segmentation\
**Created:** [February 5, 2021, 9:21pm UTC](https://discourse.slicer.org/t/calculate-axis-of-rotation/15871 "2021-02-05T21:21:35Z")\
**Posts on this page:** 1\
**Showing post:** 17

<div class="post-metadata">

**Author:** ![Selva](https://avatars.discourse-cdn.com/v4/letter/s/13edae/32.png) [@Selva](https://discourse.slicer.org/u/Selva)\
**Post date:** [February 24, 2021, 6:38am UTC](https://discourse.slicer.org/t/calculate-axis-of-rotation/15871/17 "2021-02-24T06:38:30Z")

</div>

Thanks for kind support @lassoan

Found this, after some research

"Similarly we can also calculate backwards and find the intantanous axis of rotation at some distance  
−  
⃗  
r  
from any point if we know the linear velocity of the point and the angular velocity. This is given by:

[\begin{equation} \label{eq:2} -\vec{r}= \frac{\vec{\omega} \times \vec{v}\_P }{ \vec{\omega}\cdot\vec{\omega} } \end{equation}]  
Thus if know the position of a point  
⃗  
r  
P  
, its linear velocity  
⃗  
v  
P  
we can find closest point  
⃗  
r  
C  
on the rotation axis as:

[\vec{r}\_C = \vec{r}\_P - \vec{r} = \vec{r}\_P + \frac{\vec{\omega}\times\vec{v}\_P}{\vec{\omega}\cdot\vec{\omega} }]

Script

```auto
   AnyKinRotational Rotational ={
     AngVelOnOff = On;
     AnyRefFrame& Ref1= .ReferenceFrame;
   }; 

   AnyKinLinear Linear ={
     Ref=-1;
     AnyRefFrame& Ref1= .ReferenceFrame;
   };
   
   /// Direction of the instantaneous axis of rotation
   AnyVec3 e_iaor = Rotational.Vel/vnorm(Rotational.Vel)

   /// The point on the rotation axis closest to ReferenceFrame origin
   AnyVec3 r_iaor = Linear.Pos + cross(Rotational.Vel, Linear.Vel)/(vnorm(Rotational.Vel)^2);

```

Unfortunately I cant use the same software, as it only runs on Windows  
Is there any possibility that slicer could enable this function, Thanks

---

_[View the full topic](https://discourse.slicer.org/t/calculate-axis-of-rotation/15871)._
