Skip to content
Snippets Groups Projects
Commit 07041365 authored by Henry Weller's avatar Henry Weller
Browse files

primitives/transform: Added functios to generate rotation tensor about the given axis

parent fa83f2a9
No related merge requests found
...@@ -119,6 +119,29 @@ inline tensor Rz(const scalar& omega) ...@@ -119,6 +119,29 @@ inline tensor Rz(const scalar& omega)
} }
//- Rotational transformation tensor about axis a by omega radians
inline tensor Ra(const vector& a, const scalar omega)
{
const scalar s = sin(omega);
const scalar c = cos(omega);
return tensor
(
sqr(a.x())*(1 - c) + c,
a.y()*a.x()*(1 - c) + a.z()*s,
a.x()*a.z()*(1 - c) - a.y()*s,
a.x()*a.y()*(1 - c) - a.z()*s,
sqr(a.y())*(1 - c) + c,
a.y()*a.z()*(1 - c) + a.x()*s,
a.x()*a.z()*(1 - c) + a.y()*s,
a.y()*a.z()*(1 - c) - a.x()*s,
sqr(a.z())*(1 - c) + c
);
}
inline label transform(const tensor&, const bool i) inline label transform(const tensor&, const bool i)
{ {
return i; return i;
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment