|
Revision 2, 0.8 kB
(checked in by yumileroy, 17 years ago)
|
|
[svn] * Proper SVN structure
Original author: Neo2003
Date: 2008-10-02 16:23:55-05:00
|
| Line | |
|---|
| 1 | /** |
|---|
| 2 | Quat.inl |
|---|
| 3 | |
|---|
| 4 | @cite Quaternion implementation based on Watt & Watt page 363. |
|---|
| 5 | Thanks to Max McGuire for slerp optimizations. |
|---|
| 6 | |
|---|
| 7 | @maintainer Morgan McGuire, matrix@graphics3d.com |
|---|
| 8 | |
|---|
| 9 | @created 2002-01-23 |
|---|
| 10 | @edited 2004-03-04 |
|---|
| 11 | */ |
|---|
| 12 | |
|---|
| 13 | namespace G3D { |
|---|
| 14 | |
|---|
| 15 | inline float& Quat::operator[] (int i) { |
|---|
| 16 | debugAssert(i >= 0); |
|---|
| 17 | debugAssert(i < 4); |
|---|
| 18 | return ((float*)this)[i]; |
|---|
| 19 | } |
|---|
| 20 | |
|---|
| 21 | inline const float& Quat::operator[] (int i) const { |
|---|
| 22 | debugAssert(i >= 0); |
|---|
| 23 | debugAssert(i < 4); |
|---|
| 24 | return ((float*)this)[i]; |
|---|
| 25 | } |
|---|
| 26 | |
|---|
| 27 | |
|---|
| 28 | |
|---|
| 29 | inline Quat Quat::operator-(const Quat& other) const { |
|---|
| 30 | return Quat(x - other.x, y - other.y, z - other.z, w - other.w); |
|---|
| 31 | } |
|---|
| 32 | |
|---|
| 33 | inline Quat Quat::operator+(const Quat& other) const { |
|---|
| 34 | return Quat(x + other.x, y + other.y, z + other.z, w + other.w); |
|---|
| 35 | } |
|---|
| 36 | |
|---|
| 37 | } |
|---|
| 38 | |
|---|