FineKernelToolKit  2.9.0
 全て クラス ネームスペース ファイル 関数 変数 型定義 列挙型 列挙型の値 フレンド マクロ定義 ページ
Math.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_MATH_HEADER__
73 #define __FK_MATH_HEADER__
74 
75 #include <FK/Complex.h>
76 #include <FK/Quaternion.h>
77 
79 
92 class fk_Math {
93  public:
94 
96 
108  static double clamp(double a, double min, double max);
109 
110 
112 
130  static bool isOnLine(const fk_Vector &A,
131  const fk_Vector &B,
132  const fk_Vector &P);
133 
134 
136 
160  static bool isOnLineSegment(const fk_Vector &A,
161  const fk_Vector &B,
162  const fk_Vector &P,
163  bool openFlg = true);
164 
165 
167 
184  static bool isCrossLine(const fk_Vector &A, const fk_Vector &B,
185  const fk_Vector &C, const fk_Vector &D);
186 
188 
216  static bool isCrossLineSegment(const fk_Vector &A, const fk_Vector &B,
217  const fk_Vector &C, const fk_Vector &D,
218  bool openFlg = true);
219 
221 
241  static double calcClosestPtSegToSeg(const fk_Vector &A, const fk_Vector &B,
242  const fk_Vector &C, const fk_Vector &D,
243  double *s, double *t, fk_Vector *P, fk_Vector *Q);
244 
245 
247 
257  static void calcClosestPtPtToSeg(const fk_Vector &C, const fk_Vector &A, const fk_Vector &B,
258  double *t, fk_Vector *P);
259 
260 
262 
297  static bool calcCrossLineAndTri(const fk_Vector &P,
298  const fk_Vector &Q,
299  const fk_Vector &A,
300  const fk_Vector &B,
301  const fk_Vector &C,
302  fk_Vector *R = NULL);
303 
305 
317  static double calcCosine(fk_Vector A, fk_Vector B);
318 
320 
344  static fk_Vector divideVec(const fk_Vector &V,
345  const fk_Vector &A,
346  const fk_Vector &B,
347  const fk_Vector &C);
348 
350 
379  static fk_Quaternion & quatInterLinear(const fk_Quaternion &q1,
380  const fk_Quaternion &q2,
381  double t);
382 
384 
416  static fk_Quaternion & quatInterSphere(const fk_Quaternion &q1,
417  const fk_Quaternion &q2,
418  double t);
419 
421  static fk_Complex & cexp(const fk_Complex &z);
422 
424  static fk_Complex & csin(const fk_Complex &z);
425 
427  static fk_Complex & ccos(const fk_Complex &z);
428 };
429 
430 
431 #endif // !__FK_MATH_HEADER__
static fk_Vector divideVec(const fk_Vector &V, const fk_Vector &A, const fk_Vector &B, const fk_Vector &C)
ベクトル分離係数算出関数
static bool calcCrossLineAndTri(const fk_Vector &P, const fk_Vector &Q, const fk_Vector &A, const fk_Vector &B, const fk_Vector &C, fk_Vector *R=NULL)
三角形対線分交差判定関数
static double calcClosestPtSegToSeg(const fk_Vector &A, const fk_Vector &B, const fk_Vector &C, const fk_Vector &D, double *s, double *t, fk_Vector *P, fk_Vector *Q)
線分対線分・最近接点算出関数
複素数を管理するクラス
Definition: Complex.h:79
static fk_Quaternion & quatInterSphere(const fk_Quaternion &q1, const fk_Quaternion &q2, double t)
四元数球面線形補間関数
static void calcClosestPtPtToSeg(const fk_Vector &C, const fk_Vector &A, const fk_Vector &B, double *t, fk_Vector *P)
点対線分・最近接点算出関数
3次元ベクトルを管理するクラス
Definition: Vector.h:110
四元数(クォータニオン)を管理するクラス
Definition: Quaternion.h:113
static fk_Quaternion & quatInterLinear(const fk_Quaternion &q1, const fk_Quaternion &q2, double t)
四元数単純線形補間関数
static bool isOnLine(const fk_Vector &A, const fk_Vector &B, const fk_Vector &P)
直線上判定関数
static fk_Complex & cexp(const fk_Complex &z)
複素指数関数
数学処理関数集合クラス
Definition: Math.h:92
static double clamp(double a, double min, double max)
数値範囲制限関数
static double calcCosine(fk_Vector A, fk_Vector B)
余弦値算出関数
static bool isCrossLineSegment(const fk_Vector &A, const fk_Vector &B, const fk_Vector &C, const fk_Vector &D, bool openFlg=true)
線分交差判定関数
static bool isCrossLine(const fk_Vector &A, const fk_Vector &B, const fk_Vector &C, const fk_Vector &D)
直線交差判定関数
static fk_Complex & csin(const fk_Complex &z)
複素正弦関数
static bool isOnLineSegment(const fk_Vector &A, const fk_Vector &B, const fk_Vector &P, bool openFlg=true)
線分上判定関数
static fk_Complex & ccos(const fk_Complex &z)
複素余弦関数