FineKernelToolKit  2.9.0
 全て クラス ネームスペース ファイル 関数 変数 型定義 列挙型 列挙型の値 フレンド マクロ定義 ページ
Plane.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_PLANE_HEADER__
73 #define __FK_PLANE_HEADER__
74 
75 #include <FK/Vector.h>
76 
78 
96 class fk_Plane : public fk_BaseObject {
97 
98  private:
99  // 平面上の一点
100  fk_Vector base;
101 
102  // u, v 方向単位ベクトル
103  fk_Vector uVec, vVec;
104 
105  // 法線ベクトル
106  fk_Vector norm;
107 
108  // 原点からの距離
109  double dist;
110 
111  bool distFlag;
112 
113  void CalcDist(void);
114 
115  public:
116 
118  fk_Plane(void);
119 
121  virtual ~fk_Plane();
122 
124 
134  bool setPosNormal(const fk_Vector &pos, const fk_Vector &norm);
135 
137 
150  bool set3Pos(const fk_Vector &pos1,
151  const fk_Vector &pos2,
152  const fk_Vector &pos3);
153 
155 
167  bool setPosUVVec(const fk_Vector &pos,
168  const fk_Vector &U,
169  const fk_Vector &V);
170 
172 
177  fk_Vector getBasePos(void);
178 
180 
185  fk_Vector getUVec(void);
186 
188 
193  fk_Vector getVVec(void);
194 
196 
201  fk_Vector getNormal(void);
202 
204 
209  double getDist(void);
210 
212 
219  double getDist(const fk_Vector &pos);
220 
222 
230  fk_Vector getPos(double u, double v);
231 
233 
241  bool isParallel(const fk_Vector &V);
242 
243  // 平面平行判定関数
251  bool isParallel(const fk_Plane &P);
252 
254 
262  bool isVertical(const fk_Vector &V);
263 
264  // 平面垂直判定関数
272  bool isVertical(const fk_Plane &P);
273 
275 
286  bool calcCrossPos(const fk_Vector &A,
287  const fk_Vector &B,
288  fk_Vector *pos);
289 
291 
306  bool calcCrossLineParam(const fk_Vector & A,
307  const fk_Vector & B,
308  double *t);
309 
311 
324  bool calcCrossPlaneParam(const fk_Vector &A,
325  const fk_Vector &B,
326  double *u, double *v);
327 
329 
348  bool calcCrossAll(const fk_Vector &A,
349  const fk_Vector &B,
350  fk_Vector *pos,
351  double *t,
352  double *u, double *v);
353 
354 };
355 
356 #endif // __FK_PLANE_HEADER__
bool setPosUVVec(const fk_Vector &pos, const fk_Vector &U, const fk_Vector &V)
平面設定関数3
幾何平面を管理するクラス
Definition: Plane.h:96
bool setPosNormal(const fk_Vector &pos, const fk_Vector &norm)
平面設定関数1
bool isVertical(const fk_Vector &V)
ベクトル垂直判定関数
fk_Vector getPos(double u, double v)
u,v パラメータによる平面上点参照関数
fk_Vector getBasePos(void)
基点ベクトル参照関数
double getDist(void)
原点距離参照関数
3次元ベクトルを管理するクラス
Definition: Vector.h:110
bool calcCrossPlaneParam(const fk_Vector &A, const fk_Vector &B, double *u, double *v)
交点平面パラメータ参照関数
fk_Vector getNormal(void)
法線ベクトル参照関数
bool calcCrossAll(const fk_Vector &A, const fk_Vector &B, fk_Vector *pos, double *t, double *u, double *v)
交点情報参照関数
virtual ~fk_Plane()
デストラクタ
bool isParallel(const fk_Vector &V)
ベクトル平行判定関数
fk_Vector getVVec(void)
Vベクトル参照関数
FK の各クラスの基盤となる基本クラス
Definition: Base.h:212
fk_Vector getUVec(void)
Uベクトル参照関数
bool calcCrossLineParam(const fk_Vector &A, const fk_Vector &B, double *t)
交点直線パラメータ参照関数
bool set3Pos(const fk_Vector &pos1, const fk_Vector &pos2, const fk_Vector &pos3)
平面設定関数2
fk_Plane(void)
コンストラクタ
bool calcCrossPos(const fk_Vector &A, const fk_Vector &B, fk_Vector *pos)
交点位置ベクトル参照関数