FineKernelToolKit  2.9.0
 全て クラス ネームスペース ファイル 関数 変数 型定義 列挙型 列挙型の値 フレンド マクロ定義 ページ
Quaternion.h
説明を見る。
1 /****************************************************************************
2  *
3  * Copyright (c) 1999-2014, Fine Kernel Project, All rights reserved.
4  *
5  * Redistribution and use in source and binary forms,
6  * with or without modification, are permitted provided that the
7  * following conditions are met:
8  *
9  * - Redistributions of source code must retain the above
10  * copyright notice, this list of conditions and the
11  * following disclaimer.
12  *
13  * - Redistributions in binary form must reproduce the above
14  * copyright notice, this list of conditions and the
15  * following disclaimer in the documentation and/or
16  * other materials provided with the distribution.
17  *
18  * - Neither the name of the copyright holders nor the names
19  * of its contributors may be used to endorse or promote
20  * products derived from this software without specific
21  * prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
26  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
27  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
29  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
30  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
32  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
33  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34  * POSSIBILITY OF SUCH DAMAGE.
35  *
36  ****************************************************************************/
37 /****************************************************************************
38  *
39  * Copyright (c) 1999-2014, Fine Kernel Project, All rights reserved.
40  *
41  * 本ソフトウェアおよびソースコードのライセンスは、基本的に
42  * 「修正 BSD ライセンス」に従います。以下にその詳細を記します。
43  *
44  * ソースコード形式かバイナリ形式か、変更するかしないかを問わず、
45  * 以下の条件を満たす場合に限り、再頒布および使用が許可されます。
46  *
47  * - ソースコードを再頒布する場合、上記の著作権表示、本条件一覧、
48  * および下記免責条項を含めること。
49  *
50  * - バイナリ形式で再頒布する場合、頒布物に付属のドキュメント等の
51  * 資料に、上記の著作権表示、本条件一覧、および下記免責条項を
52  * 含めること。
53  *
54  * - 書面による特別の許可なしに、本ソフトウェアから派生した製品の
55  * 宣伝または販売促進に、本ソフトウェアの著作権者の名前または
56  * コントリビューターの名前を使用してはならない。
57  *
58  * 本ソフトウェアは、著作権者およびコントリビューターによって「現
59  * 状のまま」提供されており、明示黙示を問わず、商業的な使用可能性、
60  * および特定の目的に対する適合性に関す暗黙の保証も含め、またそれ
61  * に限定されない、いかなる保証もないものとします。著作権者もコン
62  * トリビューターも、事由のいかんを問わず、損害発生の原因いかんを
63  * 問わず、かつ責任の根拠が契約であるか厳格責任であるか(過失その
64  * 他の)不法行為であるかを問わず、仮にそのような損害が発生する可
65  * 能性を知らされていたとしても、本ソフトウェアの使用によって発生
66  * した(代替品または代用サービスの調達、使用の喪失、データの喪失、
67  * 利益の喪失、業務の中断も含め、またそれに限定されない)直接損害、
68  * 間接損害、偶発的な損害、特別損害、懲罰的損害、または結果損害に
69  * ついて、一切責任を負わないものとします。
70  *
71  ****************************************************************************/
72 #ifndef __FK_QUATERNION_HEADER__
73 #define __FK_QUATERNION_HEADER__
74 
75 #include <FK/Vector.h>
76 #include <FK/Angle.h>
77 #include <FK/Matrix.h>
78 
80 
114  public:
115  double s;
117 
119 
123  fk_Quaternion(void);
124 
126 
139  fk_Quaternion(double s, double x, double y, double z);
140 
142 
153  fk_Quaternion(const double s, const fk_Vector &v);
154 
156  fk_Quaternion(const fk_Quaternion &);
157 
159 
160 
162 
172  fk_Quaternion & operator -(void) const;
173 
175 
187  fk_Quaternion & operator ~(void) const;
188 
190 
208  fk_Quaternion & operator !(void) const;
209 
211 
213 
214 
216 
227  bool operator ==(const fk_Quaternion &) const;
228 
230 
241  bool operator !=(const fk_Quaternion &) const;
242 
244 
246 
247 
250 
252 
268 
270 
280  fk_Quaternion & operator *=(double);
281 
283 
293  fk_Quaternion & operator /=(double);
294 
296 
307 
309 
320 
322 
324 
325 
327 
330  void init(void);
331 
333 
347  void set(double s, double x, double y, double z);
348 
350 
363  void set(double s, const fk_Vector &v);
364 
366 
385  void setRotate(double theta, double x, double y, double z);
386 
388 
405  void setRotate(double theta, const fk_Vector &V);
406 
408 
417  void makeEuler(double h, double p, double b);
418 
420 
427  void makeEuler(const fk_Angle &angle);
428 
430 
437  fk_Angle & getEuler(void) const;
438 
440 
449  double norm(void) const;
450 
452 
461  double abs(void) const;
462 
464 
470  bool normalize(void);
471 
473 
482  void conj(void); // 共役化
483 
485 
502  bool inverse(void); // 逆元化
503 
505 
509  fk_Matrix & conv(void) const;
510 
512 
514 
515  friend fk_Quaternion operator *(const fk_Quaternion &,
516  const fk_Quaternion &);
517  friend fk_Quaternion operator +(const fk_Quaternion &,
518  const fk_Quaternion &);
519  friend fk_Quaternion operator -(const fk_Quaternion &,
520  const fk_Quaternion &);
521 
522  friend fk_Quaternion operator *(const fk_Quaternion &, double);
523  friend fk_Quaternion operator *(double, const fk_Quaternion &);
524  friend fk_Quaternion operator /(const fk_Quaternion &, double);
525 
526  friend fk_Vector operator *(const fk_Quaternion &,
527  const fk_Vector &);
528 
529  friend double operator ^(const fk_Quaternion &,
530  const fk_Quaternion &);
532 };
533 
535 
560 
562 
570 
572 
580 
582 
591 fk_Quaternion operator *(const fk_Quaternion &, double);
592 
594 
603 fk_Quaternion operator *(double, const fk_Quaternion &);
604 
606 
613 fk_Quaternion operator /(const fk_Quaternion &, double);
614 
616 
630 fk_Vector operator *(const fk_Quaternion &, const fk_Vector &);
631 
633 
655 double operator ^(const fk_Quaternion &, const fk_Quaternion &);
656 
658  const fk_Quaternion &, double);
659 
661  const fk_Quaternion &, double);
662 
663 #endif // !__FK_QUATERNION_HEADER__
fk_Quaternion & operator/=(double)
スカラー商代入演算子
一般4元正方行列を管理するクラス
Definition: Matrix.h:586
fk_Quaternion(void)
コンストラクタ1
void init(void)
初期化関数
fk_GenVector operator^(const fk_GenVector &P, const fk_GenVector &Q)
外積二項演算子
void set(double s, double x, double y, double z)
成分設定関数1
bool normalize(void)
正規化関数
fk_Quaternion & operator-=(const fk_Quaternion &)
単項差代入演算子
fk_GenMatrix operator-(const fk_GenMatrix &, const fk_GenMatrix &)
行列差二項演算子
bool operator!=(const fk_Quaternion &) const
異値比較演算子
オイラー角を表すクラス
Definition: Angle.h:90
3次元ベクトルを管理するクラス
Definition: Vector.h:110
void conj(void)
共役化関数
void setRotate(double theta, double x, double y, double z)
回転変換設定関数1
double norm(void) const
ノルム取得関数
四元数(クォータニオン)を管理するクラス
Definition: Quaternion.h:113
fk_GenVector operator*(const fk_GenMatrix &, const fk_GenVector &)
ベクトル変換二項演算子
fk_Vector v
ベクトル部
Definition: Quaternion.h:116
friend fk_Quaternion operator/(const fk_Quaternion &, double)
四元数スカラー商二項演算子
friend fk_Quaternion operator*(const fk_Quaternion &, const fk_Quaternion &)
四元数積二項演算子
bool operator==(const fk_Quaternion &) const
同値比較演算子
fk_Quaternion & fk_Q_Inter_Sphere(const fk_Quaternion &, const fk_Quaternion &, double)
fk_Matrix & conv(void) const
行列変換関数
fk_Quaternion & operator-(void) const
単項マイナス演算子
fk_GenVector operator/(const fk_GenVector &V, double d)
実数商二項演算子
friend fk_Quaternion operator+(const fk_Quaternion &, const fk_Quaternion &)
四元数和二項演算子
fk_GenMatrix operator+(const fk_GenMatrix &, const fk_GenMatrix &)
行列和二項演算子
void makeEuler(double h, double p, double b)
オイラー角変換設定関数1
fk_Quaternion & operator*=(const fk_Quaternion &)
積代入演算子
fk_Quaternion & operator=(const fk_Quaternion &)
単純代入演算子
fk_Quaternion & fk_Q_Inter_Linear(const fk_Quaternion &, const fk_Quaternion &, double)
double s
スカラー部
Definition: Quaternion.h:115
double abs(void) const
絶対値取得関数
bool inverse(void)
逆元化関数
fk_Quaternion & operator~(void) const
単項共役演算子
fk_Quaternion & operator!(void) const
単項逆元演算子
fk_Quaternion & operator+=(const fk_Quaternion &)
単項和代入演算子
fk_Angle & getEuler(void) const
オイラー角取得関数
friend double operator^(const fk_Quaternion &, const fk_Quaternion &)
四元数内積二項演算子