primitives/transform: Added functios to generate rotation tensor about the given axis
This commit is contained in:
parent
69dd56b9dd
commit
e2d1156ddd
1 changed files with 23 additions and 0 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue