MGCL V10  V10
MGCL V10
 全て クラス 名前空間 関数 変数 型定義 列挙型 列挙値 フレンド グループ ページ
Unit_vector.h
1 /********************************************************************/
2 /* Copyright (c) 2015 DG Technologies Inc. and Yuzi Mizuno */
3 /* All rights reserved. */
4 /********************************************************************/
5 #ifndef _MGUnit_vector_HH_
6 #define _MGUnit_vector_HH_
7 
11 #include "mg/Vector.h"
12 
13 // MGUnit_vector.h
14 // Header for class MGUnit_vector
15 
17 class MG_DLL_DECLR MGUnit_vector: public MGVector {
18 
19 public:
20 
22 MG_DLL_DECLR friend std::ostream& operator<<(std::ostream&, const MGUnit_vector& );
23 
24 //
25 // ////// Constructor.コンストラクタ /////////
26 //
27 
30  int sdim=3
31 );
32 
35 MGUnit_vector(const MGVector& v);
36 
37 //
38 // //////// Operator overload.演算子定義 ////////
39 //
40 
42 MGUnit_vector& operator= (const MGVector& vec2) ;
43 
48 MGUnit_vector& operator= (const double*);
49 
51 //The result is unit of the vector of two vector addition.
53 MGUnit_vector& operator+= (const MGVector& vec2);
54 
58 
62 MGUnit_vector& operator-= (const MGVector& vec2);
63 
65 //Cchanges to 3D vector. The result is a unit one of two vector product.
66 MGUnit_vector& operator*= (const MGVector& vec2);
67 
69 
73 void orthonormal(const MGVector& sv
74  , MGUnit_vector& v1, MGUnit_vector& v2) const;
75 
76 private:
77 
78 //プライベートメンバ関数: MGVector に定義されているが、MGUnit_vector
79 //の利用者に利用できなくするために、private で定義する。
80 //The following private functions are defined to prohibit their use
81 //of inheritting MGVector.
82 
83 // スカラーの乗算を行い自身のベクトルとする.
84 MGUnit_vector& operator *= ( double );
85 
86 // スカラー除算を行い自身のベクトルとする.
87 MGUnit_vector& operator /= ( double );
88 
89 };
90 
96  const MGPosition& P0, // 三角形の頂点の座標
97  const MGPosition& P1,
98  const MGPosition& P2
99 );
100  // end of BASE group
102 #endif
MGUnit_vector UnitNormal(const MGPosition &P0, const MGPosition &P1, const MGPosition &P2)
MGVector & operator*=(double scale)
Vector of a general n space dimension.
Definition: Vector.h:26
MGVector & operator=(const MGVector &)
Assignment.
MG_DLL_DECLR friend std::ostream & operator<<(std::ostream &, const MGVector &)
String stream function.
MGVector & operator/=(double scale)
MGVector & operator+=(const MGVector &)
Represent a positional data.
Definition: Position.h:28
MGVector & operator-=(const MGVector &)
MGVector operator-() const
Define a unit vector, is a MGVector.
Definition: Unit_vector.h:17