diff --git a/src/OpenFOAM/primitives/septernion/septernion.C b/src/OpenFOAM/primitives/septernion/septernion.C index ffac2bd609..67cae051fd 100644 --- a/src/OpenFOAM/primitives/septernion/septernion.C +++ b/src/OpenFOAM/primitives/septernion/septernion.C @@ -59,6 +59,17 @@ Foam::word Foam::name(const septernion& s) } +Foam::septernion Foam::slerp +( + const septernion& qa, + const septernion& qb, + const scalar t +) +{ + return septernion((1.0-t)*qa.t()+t*qb.t(), slerp(qa.r(), qb.r(), t)); +} + + // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // Foam::Istream& Foam::operator>>(Istream& is, septernion& s) diff --git a/src/OpenFOAM/primitives/septernion/septernion.H b/src/OpenFOAM/primitives/septernion/septernion.H index 03253ed7b9..b6a672f3ec 100644 --- a/src/OpenFOAM/primitives/septernion/septernion.H +++ b/src/OpenFOAM/primitives/septernion/septernion.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -157,6 +157,13 @@ inline septernion inv(const septernion& tr); //- Return a string representation of a septernion word name(const septernion&); +//- Spherical linear interpolation of septernions. 0 for qa, 1 for qb +septernion slerp +( + const septernion& qa, + const septernion& qb, + const scalar t +); //- Data associated with septernion type are contiguous template<>