diff options
| author | Egor Yusov <egor.yusov@gmail.com> | 2019-09-28 04:15:42 +0000 |
|---|---|---|
| committer | Egor Yusov <egor.yusov@gmail.com> | 2019-09-28 04:15:42 +0000 |
| commit | 73dc6896b5787f4e7f2d332968852e6ce4eee8ed (patch) | |
| tree | b06e0e82c48336df8efa8e939cdae65473679d08 /Common/interface | |
| parent | Added EngineD3D12CreateInfo::EnableDebugLayer (updated API Version to 240030) (diff) | |
| download | DiligentCore-73dc6896b5787f4e7f2d332968852e6ce4eee8ed.tar.gz DiligentCore-73dc6896b5787f4e7f2d332968852e6ce4eee8ed.zip | |
Added Quaternion::RotateVector method
Diffstat (limited to 'Common/interface')
| -rw-r--r-- | Common/interface/BasicMath.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Common/interface/BasicMath.h b/Common/interface/BasicMath.h index 1e2c2c55..8623bb47 100644 --- a/Common/interface/BasicMath.h +++ b/Common/interface/BasicMath.h @@ -1710,6 +1710,12 @@ struct Quaternion *this = Mul(*this, rhs); return *this; } + + float3 RotateVector(const float3& v)const + { + const float3 axis(q.x, q.y, q.z); + return v + 2.f * cross(axis, cross(axis, v) + q.w * v); + } }; inline Quaternion operator* (const Quaternion& q1, const Quaternion& q2) |
