Commit e2d1156d authored by Henry Weller's avatar Henry Weller
Browse files

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

parent 69dd56b9
......@@ -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)
{
return i;
......
Supports Markdown
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