Skip to content

Commit 4926007

Browse files
committed
Updates
1 parent 42a382a commit 4926007

File tree

3 files changed

+136
-174
lines changed

3 files changed

+136
-174
lines changed

InstantaneousAxisOfRotation.any

Lines changed: 47 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -57,40 +57,58 @@ The object will IAOR object will plot the axis, and provide the following output
5757
AnyRefFrame& Body2,
5858
SHOW_LINEAR_VELOCITY = "On",
5959
AXIS_LOCATION = "MIDPOINT",
60-
SHOW_SHORTEST_DIST = "On"
61-
){
60+
SHOW_SHORTEST_DIST = "On")
61+
{
6262

63+
AnyKinLinear Linear ={
64+
Ref=0;
65+
AnyRefFrame &Body1= .Body1;
66+
AnyRefFrame &Body2= .Body2;
67+
};
68+
69+
AnyKinRotational Rotational ={
70+
Type = RotVector;
71+
AngVelOnOff = On;
72+
AnyRefFrame &Body1= .Body1;
73+
AnyRefFrame &Body2= .Body2;
74+
};
75+
76+
/// Size of the drawn spheres
6377
#var AnyVar SphereSize=0.02;
78+
79+
/// Length of the axis drawn
6480
#var AnyVar AxisLength=2;
81+
82+
/// Thickness of the axis drawn
6583
#var AnyVar AxisThickness = 0.01;
6684

6785

68-
/// Rotational Velocity of Body2 with repect to Body1
69-
AnyVec3 omega = Rotational.Vel;
70-
71-
/// Linear Velociy of Body2 with respect to Body1
72-
AnyVec3 r_dot = Linear.Vel;
73-
74-
/// Postion of Body2 with respect to Body1
75-
AnyVec3 r = Linear.Pos;
76-
77-
/// The rotation magnitude
78-
AnyVar RotationMagnitude = iffun(eqfun(vnorm(omega),0),1e-15, vnorm(omega));
79-
80-
/// The rotation axis direction
81-
AnyVec3 RotationAxisDirection = omega/RotationMagnitude;
82-
83-
/// The point on the rotation axis closest to Body2
84-
AnyVec3 rc_2 = r + cross(omega, r_dot)/(RotationMagnitude^2);
85-
86-
/// The point on the rotation axis closest to Body1
87-
AnyVec3 rc_1 = rc_2-rc_2*RotationAxisDirection'*RotationAxisDirection;
88-
89-
/// The motion pitch or the ratio of linear motion to angular motion
90-
AnyVar MotionPitch = (omega*r_dot')/(RotationMagnitude^2);
91-
92-
/// Linear Velocity of points on the rotation axis
93-
AnyVec3 rc_dot = MotionPitch*omega;
86+
/// Rotational Velocity of Body2 with repect to Body1
87+
AnyVec3 omega = Rotational.Vel;
88+
89+
/// Linear Velociy of Body2 with respect to Body1
90+
AnyVec3 r_dot = Linear.Vel;
91+
92+
/// Postion of Body2 with respect to Body1
93+
AnyVec3 r = Linear.Pos;
94+
95+
/// The rotation magnitude
96+
AnyVar RotationMagnitude = iffun(eqfun(vnorm(omega),0),1e-15, vnorm(omega));
97+
98+
/// The rotation axis direction
99+
AnyVec3 RotationAxisDirection = omega/RotationMagnitude;
100+
101+
/// The point on the rotation axis closest to Body2
102+
AnyVec3 rc_2 = r + cross(omega, r_dot)/(RotationMagnitude^2);
103+
104+
/// The point on the rotation axis closest to Body1
105+
AnyVec3 rc_1 = rc_2-rc_2*RotationAxisDirection'*RotationAxisDirection;
106+
107+
/// The motion pitch or the ratio of linear motion to angular motion
108+
AnyVar MotionPitch = (omega*r_dot')/(RotationMagnitude^2);
109+
110+
/// Linear Velocity of points on the rotation axis
111+
AnyVec3 rc_dot = MotionPitch*omega;
94112

95113
AnyFolder Visualizations =
96114
{
@@ -169,17 +187,6 @@ The object will IAOR object will plot the axis, and provide the following output
169187
};
170188
#endif
171189
};
172-
AnyKinLinear Linear ={
173-
Ref=0;
174-
AnyRefFrame &Body1= .Body1;
175-
AnyRefFrame &Body2= .Body2;
176-
};
177-
178-
AnyKinRotational Rotational ={
179-
Type = RotVector;
180-
AngVelOnOff = On;
181-
AnyRefFrame &Body1= .Body1;
182-
AnyRefFrame &Body2= .Body2;
183-
};
190+
184191

185192
};

Readme.md

Lines changed: 89 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,115 @@
11
# Class for calculating Instantaneous Axis of Rotation
22

3-
The `InstantaneousAxisOfRotation` class template will calculate the instantenous axis of rotation between two bodies.
3+
The instantaneous axis of rotation between two bodies is a useful concept in
4+
biomechanics. In this post, we will dig into how to calculate the instantaneous
5+
axis of rotation and show off an AnyScript `class_template` to do this
6+
calculation and plot the axis between any two reference frames in the AnyBody
7+
Modeling System.
48

5-
Instantenous axis of rotation are the points fixed to a body undergoing planar movement that has zero velocity at a particular instant of time. At this instant, the velocity vectors of the trajectories of other points in the body generate a circular field around this point which is identical to what is generated by a pure rotation.
9+
The are several papers that discusses the
10+
importance of the instantaneous axis of rotation in biomechanics. See for
11+
example XX and XX. But first, let us look briefly at the math behind.
612

7-
Planar movement of a body is often described using a plane figure moving in a two-dimensional plane. The instant centre is the point in the moving plane around which all other points are rotating at a specific instant of time.
13+
## 3D Rotations
814

9-
The continuous movement of a plane has an instant centre for every value of the time parameter. This generates a curve called the moving centrode. The points in the fixed plane corresponding to these instant centres form the fixed centrode.
15+
We can view any displacement of a body in a three-dimensional space as rotation
16+
around a single axis and a translation along that axis. This gives rise to the
17+
idea of a screw motion in 3D along what is also called the helical axis. If we
18+
spit the movement up into infinitesimally small movements each of these will
19+
have an rotation axis and a linear velocity along that axis. This is the
20+
instantaneous axis of rotation, and as the name indicate will change direction
21+
and location as the object moves.
1022

11-
------------------------------------------------------------------------------
23+
If we know the angular and linear velocity of any point on a rigid body, we can
24+
calculate the properties of the screw motion and the instantaneous axis of
25+
rotation.
1226

13-
Think of rotation as a manifestation of a change in coordinate direction. Affix a coordinate system at _any_ point on a rigid body and it is going to change direction _at the same rate_ regardless of the point location (even at the rotation axis). This is why angular velocity is shared among the entire rigid body.
27+
From a mathematical point of view the rate of change of a 3x3 rotation matrix
28+
$R$ is:
1429

15-
Mathematically, the rate of change of a 3×3 rotation matrix $R$ is $$ \frac{{\rm d}}{{\rm d}t}R = \vec{\omega} \times R$$ where $\vec{\omega}$ is the angular rotation vector, and $\times$ the vector cross product.
30+
$$ \frac{{\mathrm d}}{{\mathrm d}t}R = \vec{\omega} \times R$$
1631

17-
For the second part of your question a general rotation _can_ be decomposed into three rotations about three predefined axes (like precession, nutation and spin), or by a single rotation about an arbitrary axis. In either case, the rotation is going to be about a single axis and you need three parameters to specify it exactly. Either three scalar angle speeds about three predefined axes, or two parameters for the rotation axis, and one for the rotation speed magnitude.
32+
where $\vec{\omega}$ is called the angular velocity vector. This angular
33+
velocity is quantity shared by all points on the rigid body (including those on
34+
the rotation axis). Using $\vec{\omega}$ we can write the linear velocity
35+
$\vec{v}$ of any point at some distance $\vec{r} from the instantaneous axis of
36+
rotation as:
1837

19-
Note also that the general motion of a rigid body is a rotation about some axis in 3D, coupled with a parallel translation along the same axis. The rotation and translation defines a screw in 3D and given the linear and angular velocities of _any_ point on the rigid body, the properties of the motion can be derived.
38+
$$\vec{v} = \vec{\omega} \times \vec{r}$$ (1)
2039

21-
For example, said rigid body has rotational velocity $\vec{\omega}$ and linear velocity $\vec{v}_A$ at some point _A_ with position $\vec{r}_A$ at some instant. The following properties are defined:
40+
Similarly we can also calculate backwards and find the intantanous axis of
41+
rotation at some distance $-\vec{r}$ from any point if we know the linear
42+
velocity of the point and the angular velocity:
2243

23-
1. The rotation axis direction is $$\vec{e} = \frac{\vec{\omega}}{|\vec{\omega}|}$$
24-
2. The rotation magnitude is $$\omega = |\vec{\omega}|$$
25-
3. The point _C_ on the rotation line closest to the origin is $$\vec{r}_C = \vec{r}_A + \frac{\vec{\omega}\times\vec{v}_A}{\omega^2}$$
26-
4. The motion pitch (ratio of linear motion to angular motion) is $$ h = \frac{\vec{\omega} \cdot \vec{v}_A}{\omega^2}$$
27-
5. The linear velocity of point _C_ is $$\vec{v}_C = h\,\vec{\omega}$$
44+
This is given by:
2845

29-
In summary, a single rotation speed, and a linear velocity vector at _some_ point is enough to describe the instantaneous motion of a rigid body both geometrically (rotation line in 3D, pitch and magnitude) and analytically (rigid body transformation of velocity to any other point).
46+
$$
47+
-\vec{r}= \frac{\vec{\omega} \times \vec{v} }{ \vec{\omega}\cdot\vec{\omega} }
48+
$$
3049

50+
Here is short proof. Skip it if you like:
3151

32-
---------------------------------------------------------
52+
>Start with $\vec{\omega} \times \vec{v}$, insert (1) and use the tripple product to expand it:
53+
>$$
54+
>\vec{\omega} \times \vec{v} = \vec{\omega} \times (\vec{\omega} \times \vec{r})=\vec{\omega}(\vec{\omega}\cdot\vec{r})-\vec{r}(\vec{\omega}\cdot\vec>{\omega})
55+
>$$
56+
>
57+
>The shortest vector $\vec{r}$ from the rotation axis to any point is by defintion perpendicular to angular velocity $\vec{\omega}$, hence:
58+
>
59+
>$$
60+
>\require{cancel}\vec{\omega} \times \vec{v} =\vec{\omega}(\cancel{\vec{\omega}\cdot\vec{r}})-\vec{r}(\vec{\omega}\cdot\vec{\omega})=-r(\vec{\omega}>\cdot\vec{\omega})
61+
>$$
3362
3463

3564

65+
Thus if know the position of a point $\vec{r}_P$ we can find closest point
66+
$\vec{r}_C$ on the rotation axis as:
3667

68+
$$\vec{r}_C = \vec{r}_P - \vec{r} = \vec{r}_P + \frac{\vec{\omega}\times\vec{v}_P}{\vec{\omega}\cdot\vec{\omega}}$$
3769

3870

3971

72+
## Properties
4073

74+
If for example we have a rigid body with angular velocity $\vec{\omega}$ and
75+
some point $P$ with position $\vec{r}_P$ and velocity $\vec{v}_p$ then we can
76+
define the different properties:
4177

78+
1. The magintude of agular rotation:
79+
$$ \omega = \|\vec{\omega}\|$$
80+
81+
2. The direction of the intantanous axis of rotation:
82+
83+
$$ \vec{v}_{IOAR} = \frac{\vec{\omega}}{\omega}$$
84+
85+
3. The point C on the intantanous axis of rotation:
86+
87+
$$\vec{r}_C = \vec{r}_P + \frac{\vec{\omega}\times\vec{v}_P}{\vec{\omega}\cdot\vec{\omega}}$$
88+
89+
4. Ratio of angular to linear angular velocity:
90+
91+
$$ h = \frac{\vec{\omega} \cdot \vec{v}_P}{\vec{\omega}\cdot\vec{\omega}}$$
92+
93+
5. The linear velocity at point $C$ along the screw axis is then given by
94+
95+
$$\vec{v}_C = h\,\vec{\omega}$$
96+
97+
98+
All we need to know is the rotation velocity of a body and the velocity of any point to find the instantaneous axis of rotation.
99+
100+
## AnyScript implementation
101+
102+
In AnyScript we can easily find the angular velocity between two reference frames using the class `AnyKinRotational` and the linear velocity using the class `AnyKinLinear`.
103+
104+
We have created a custom class_template that makes it easy to add all this code to a model and display the instantaneous axis of rotation. Here is a short example on how to use the class.
105+
106+
107+
The class template is called `InstantaneousAxisOfRotation`. does exactly this, and then calculate the properties listed above.
108+
109+
110+
111+
112+
------------------
42113

43114

44115

@@ -47,7 +118,7 @@ In summary, a single rotation speed, and a linear velocity vector at _some_ poin
47118

48119

49120
EXAMPLE:
50-
```
121+
```c++
51122
#include "<ANYBODY_PATH_TOOLBOX>/Rotations/InstantaneousAxisOfRotation.any"
52123

53124
Main = {

Test_InstantaneousAxisOfRotation.any

Lines changed: 0 additions & 116 deletions
This file was deleted.

0 commit comments

Comments
 (0)