00001 /* Copyright (c) 2005 Arachi, Inc. and Stanford University. 00002 * 00003 * Permission is hereby granted, free of charge, to any person obtaining 00004 * a copy of this software and associated documentation files (the 00005 * "Software"), to deal in the Software without restriction, including 00006 * without limitation the rights to use, copy, modify, merge, publish, 00007 * distribute, sublicense, and/or sell copies of the Software, and to 00008 * permit persons to whom the Software is furnished to do so, subject 00009 * to the following conditions: 00010 * 00011 * The above copyright notice and this permission notice shall be included 00012 * in all copies or substantial portions of the Software. 00013 * 00014 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 00015 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00016 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 00017 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 00018 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 00019 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 00020 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 00021 */ 00022 00023 #ifndef _deFrame_h 00024 #define _deFrame_h 00025 00032 class deFrame 00033 { 00034 public: 00036 deQuaternion& rotation() { return _q; } 00038 const deQuaternion& rotation() const { return _q; } 00040 deVector3& translation() { return _v;; } 00042 const deVector3& translation() const { return _v; } 00044 DE_MATH_API void identity(); 00046 DE_MATH_API void operator=(const deFrame f); 00048 DE_MATH_API void multiply(const deFrame& f1, const deFrame& f2); 00050 // = ~[r1,p1][r2,p2] = [~r1, -(~r1*p1)][r2,p2] = [~r1*r2, ~r1*p2 - (~r1*p1)] 00051 // = [~r1*r2, ~r1*(p2-p1)] 00052 DE_MATH_API void inversedMultiply(const deFrame& f1, const deFrame& f2); 00054 // = [r1,p1]~[r2,p2] = [r1,p1][~r2, -(~r2*p2)] = [r1*~r2, -r1*(~r2*p2) + p1] 00055 // = [r1*~r2, -r1*~r2*p2 + p1] 00056 DE_MATH_API void multiplyInversed(const deFrame& f1, const deFrame& f2); 00058 // = ~[r,p] = [~r, -(~r*p)] 00059 DE_MATH_API void inverse(const deFrame& f); 00061 DE_MATH_API void set(const deTransform& t); 00063 DE_MATH_API void set(const deQuaternion& q, const deVector3& v); 00064 00065 private: 00066 deQuaternion _q; 00067 deVector3 _v; 00068 }; 00069 00070 #endif // _deFrame_h 00071