MGCL V10  V10
MGCL V10
 全て クラス 名前空間 関数 変数 型定義 列挙型 列挙値 フレンド グループ ページ
MGMatrix クラス

MGMatrix is a matix of m by m, where m is the space dimension. [詳解]

公開メンバ関数

 MGMatrix (int sdim=0)
 
 MGMatrix (const MGVector &, const MGVector &)
 Construct 2D matrix from two vectors. [詳解]
 
 MGMatrix (const MGVector &, const MGVector &, const MGVector &)
 Construct 3D matrix from three vectors. [詳解]
 
 MGMatrix (int dim, double scale)
 
 MGMatrix (int dim, const double *values, bool column_wise=true)
 Construct dim dimension matrix from the array of double values. [詳解]
 
 MGMatrix (const MGVector &vec, double angle)
 
 MGMatrix (int dim, int axis1, int axis2, double cosv, double sinv)
 
 MGMatrix (int dim, const MGMatrix &, int start1=0, int start2=0)
 
 MGMatrix (const MGMatrix &mat)
 Copy constructor. [詳解]
 
 ~MGMatrix ()
 
MGMatrixoperator= (const MGMatrix &mat)
 Assignment. [詳解]
 
double operator() (int i, int j) const
 Reference (i,j)-th element. [詳解]
 
double & operator() (int i, int j)
 Access to (i,j)-th element. [詳解]
 
MGMatrix operator* (double) const
 
MGMatrixoperator*= (double)
 
MGMatrix operator* (const MGMatrix &) const
 
MGMatrixoperator*= (const MGMatrix &)
 
MGTransf operator* (const MGTransf &) const
 
bool operator== (const MGMatrix &) const
 
bool operator!= (const MGMatrix &) const
 
void convert_to_glMatrix (glm::mat4 &glMatI) const
 Convert this transf matrix to OpenGL Matrix. [詳解]
 
double determinant () const
 行列式の値を返却。 [詳解]
 
MGMatrixfrom_axis (const MGUnit_vector &uvec, int axis=0)
 
bool is_null () const
 Test if this is null. [詳解]
 
double ref (int i, int j) const
 Reference to (i,j)-th element of the matarix. [詳解]
 
MGMatrixreflection (const MGVector &vec)
 
void resize (int nsdim)
 
int sdim () const
 Return space dimension. [詳解]
 
MGMatrixset_x_axis (const MGUnit_vector &unit)
 
MGMatrixset_reflect_2D (const MGVector &)
 
MGMatrixset_rotate_2D (double angle)
 
MGMatrixset_rotate_2D (double cval, double sval)
 
MGMatrixset_axis (const MGUnit_vector &uvec, int axis=0)
 
MGMatrixset_vector (const MGUnit_vector &uvec, int axis=0)
 
MGMatrixset_xy_axis (const MGUnit_vector &uvecx, const MGUnit_vector &uvecy)
 
MGMatrixset_xy_vector (const MGUnit_vector &uvecx, const MGUnit_vector &uvecy)
 
MGMatrixset_reflect_3D (const MGVector &vec)
 
MGMatrixset_rotate (const MGVector &V0, const MGVector &V1)
 
MGMatrixset_rotate_3D (const MGVector &vec, double angle)
 
MGMatrixset_rotate_3D (const MGVector &vec, double cval, double sval)
 
MGMatrixset_scale (double)
 
MGMatrixset_diff_scale (double *)
 
MGMatrixset_glMatrix (const double glMat[16])
 Set up this matrix from OpenGL matrix. [詳解]
 
void set_null ()
 Set this as a null matrix. [詳解]
 
MGMatrix transpose () const
 
MGMatrixto_axis (const MGUnit_vector &uvec, int axis=0)
 
int dump_size () const
 
int dump (MGOfstream &) const
 Dump Function. [詳解]
 
int restore (MGIfstream &)
 Restore Function. [詳解]
 
double scale () const
 Obtain the scaling factor of this matrix. [詳解]
 

フレンド

MG_DLL_DECLR friend MGMatrix operator* (double scale, const MGMatrix &mat)
 
MG_DLL_DECLR friend std::ostream & operator<< (std::ostream &, const MGMatrix &)
 String stream Function. [詳解]
 

詳解

MGMatrix is a matix of m by m, where m is the space dimension.

MGMatrix provides transformation around the origin. General transformation is provided by MGTransf. Let M be a matrix and A be an object(including MGVector). Then matrix transformation of the object A is defined as: A*M. (Not M*A)

構築子と解体子

MGMatrix::MGMatrix ( int  sdim = 0)
explicit

void constructor:void コンストラクタ When sdim>=1, MGMatrix is initialized as a unit matrix.

MGMatrix::MGMatrix ( const MGVector ,
const MGVector  
)

Construct 2D matrix from two vectors.

MGMatrix::MGMatrix ( const MGVector ,
const MGVector ,
const MGVector  
)

Construct 3D matrix from three vectors.

MGMatrix::MGMatrix ( int  dim,
double  scale 
)

各軸方向で等しい Scaling のためのMatrixを生成。 Scaling matrix of same scaling value for each coordinate.

MGMatrix::MGMatrix ( int  dim,
const double *  values,
bool  column_wise = true 
)

Construct dim dimension matrix from the array of double values.

引数
dimdimension of the matrix.
valuesarray of values[dim*dim].
column_wiseIf column_wise=true, (*this)(i,j)=values[i+dim*j], else(row_wise), (*this)(i,j)=values[j+dim*i], for 0<=i,j<=dim-1.
MGMatrix::MGMatrix ( const MGVector vec,
double  angle 
)

与えられたVector回りに指定の角度回転させるMatrixを作成する。  Rotation matrix around vec. Space dimension of vec can be any number, i.e. can be more than 3.

MGMatrix::MGMatrix ( int  dim,
int  axis1,
int  axis2,
double  cosv,
double  sinv 
)

Construct a matrix to rotate in (axis1, axis2) plane by algle theta, where angle is defined as cosv=cos(angle), and sinv=sin(angle).

引数
dimSpace dimension(can be more than 3).
axis1axis number 1
axis2axis number 2
cosvcosv=cos(angle),
sinvsinv=sin(angel). That is cosv*cosv+sinv*sinv must be 1.
MGMatrix::MGMatrix ( int  dim,
const MGMatrix ,
int  start1 = 0,
int  start2 = 0 
)

Construct Matrix by copying old Matrix, changing space dimension and ordering of old coordinates.

MGMatrix::MGMatrix ( const MGMatrix mat)

Copy constructor.

MGMatrix::~MGMatrix ( )
inline

関数詳解

void MGMatrix::convert_to_glMatrix ( glm::mat4 &  glMatI) const

Convert this transf matrix to OpenGL Matrix.

double MGMatrix::determinant ( ) const

行列式の値を返却。

int MGMatrix::dump ( MGOfstream ) const

Dump Function.

int MGMatrix::dump_size ( ) const

Dump Functions. Calculate dump size

MGMatrix& MGMatrix::from_axis ( const MGUnit_vector uvec,
int  axis = 0 
)

Construct a matrix to transform a unit vector on an axis to a vector 'uvec', and replace own matrix with it. Inverse matrix of to_axis. axis can be any number(can be more than 2).

引数
uvecUnit vector for an axis.
axisAxis kind 0:x, 1:y, 2:z, ...
bool MGMatrix::is_null ( ) const
inline

Test if this is null.

bool MGMatrix::operator!= ( const MGMatrix ) const
double MGMatrix::operator() ( int  i,
int  j 
) const
inline

Reference (i,j)-th element.

double& MGMatrix::operator() ( int  i,
int  j 
)
inline

Access to (i,j)-th element.

MGMatrix MGMatrix::operator* ( double  ) const

自身のMatrixと与えられたscaleの乗算を行いオブジェクトを生成。 Scaling of the matrix.

MGMatrix MGMatrix::operator* ( const MGMatrix ) const

自身のMatrixと与えられたMatrixの乗算を行いオブジェクトを生成。 Matrix and matrix multiplication.

MGTransf MGMatrix::operator* ( const MGTransf ) const

自身のMatrixと与えられたTransfの乗算を行いオブジェクトを生成。 Matrix and Transf multiplication.

MGMatrix& MGMatrix::operator*= ( double  )

自身のMatrixと与えられたscaleの乗算し自身のMatrixとする。 Scaling of the matrix.

MGMatrix& MGMatrix::operator*= ( const MGMatrix )

自身のMatrixと与えられたMatrixの乗算し自身のMatrixとする。 Matrix and matrix multiplication.

MGMatrix& MGMatrix::operator= ( const MGMatrix mat)

Assignment.

bool MGMatrix::operator== ( const MGMatrix ) const

Boolean Operation 自身のMatrixと与えられたMatrixが等しいかどうか 比較を行う。 Equation comparison.

double MGMatrix::ref ( int  i,
int  j 
) const

Reference to (i,j)-th element of the matarix.

MGMatrix& MGMatrix::reflection ( const MGVector vec)

Construct a mirror reflection matrix about a plane whose normal is vec and that passes through the origin, then replace own matrix with it.

void MGMatrix::resize ( int  nsdim)

Resize, i.e., change, the space dimension. Result matreix will contain garbages.

int MGMatrix::restore ( MGIfstream )

Restore Function.

double MGMatrix::scale ( ) const

Obtain the scaling factor of this matrix.

int MGMatrix::sdim ( ) const
inline

Return space dimension.

MGMatrix& MGMatrix::set_axis ( const MGUnit_vector uvec,
int  axis = 0 
)

Construct a 3D matrix to transform a vector 'uvec' to be one of the axises, and replace own matrix. Inverse matrix of set_vector. 3D version of to_axis.

引数
uvecUnit vector to be an axis.
axisAxis kind 0:x, 1:y, 2:z.
MGMatrix& MGMatrix::set_diff_scale ( double *  )

各軸方向で異なる Scaling のためのMatrixを生成し、既存の Matrixと入れ換える。 Scaling matrix of different scaling values for each coordinate. Not change space dimension.

MGMatrix& MGMatrix::set_glMatrix ( const double  glMat[16])

Set up this matrix from OpenGL matrix.

void MGMatrix::set_null ( )

Set this as a null matrix.

MGMatrix& MGMatrix::set_reflect_2D ( const MGVector )

原点を通り、指定Vectorに関して鏡面変換する 2D Matrixを作成し, 既存のMatrixと入れ換える。 Mirror reflection 2D matrix about a vector through origin.

MGMatrix& MGMatrix::set_reflect_3D ( const MGVector vec)

原点を通り、指定Vectorに垂直な平面に関して鏡面変換する 3D Matrix を既存のMatrixと入れ換える。 3D mirror reflection matrix about a plane whose normal is vec and passes through the origin.

MGMatrix& MGMatrix::set_rotate ( const MGVector V0,
const MGVector V1 
)

(原点を基点とする)Vector V0 を V1に変換するMatrixを作成し、 自身のMatrixと入れ換える。 Construct the matrix to rotate and scale that transform vector V0 to V1, and replace this matrix with the matrix. Space dimension of V0 and V1 can be any number greater than 1.

MGMatrix& MGMatrix::set_rotate_2D ( double  angle)

原点の回りに指定の角度回転させる2D Matrixを作成し, 既存の Matrixと入れ換える。 Rotation 2D matrix around origin by angle(in radian).

MGMatrix& MGMatrix::set_rotate_2D ( double  cval,
double  sval 
)

Rotation 2D matrix around origin by an angle. The angle is given by cval as cos(angle) and sval as sin(angle).

MGMatrix& MGMatrix::set_rotate_3D ( const MGVector vec,
double  angle 
)

与えられたVector回りに指定の角度回転させる3D Matrixを作成し既存の Matrixと入れ換える。 3D rotation matrix around vec.

MGMatrix& MGMatrix::set_rotate_3D ( const MGVector vec,
double  cval,
double  sval 
)

3D rotation matrix around vec. The angle is given by cval as cos(angle) and sval as sin(angle).

MGMatrix& MGMatrix::set_scale ( double  )

各軸方向で等しい Scaling のためのMatrixを生成し、既存の Matrixと入れ換える Scaling matrix of same scaling value for each coordinate. Not change space dimension.

MGMatrix& MGMatrix::set_vector ( const MGUnit_vector uvec,
int  axis = 0 
)

Construct a matrix to transform a unit vector on an axis to a vector 'uvec', and replace own matrix with it. Inverse matrix of set_axis. 3D version of from_axis.

引数
uvecUnit vector for an axis.
axisAxis kind 0:x, 1:y, 2:z.
MGMatrix& MGMatrix::set_x_axis ( const MGUnit_vector unit)

Construct 2D space Matrix to transform for 'unit' to be x-coordimate, and replace own Matrix with it. 2D version of to_axis.

引数
unitunit vector to be x-coordinate
MGMatrix& MGMatrix::set_xy_axis ( const MGUnit_vector uvecx,
const MGUnit_vector uvecy 
)

与えられた2つの単位ベクトルを各々、X軸、Y軸にするよう原点の周りに 回転させる 3D Matrix を生成し,自身のMatrixと入れ替える。もし、 2つ目の単位ベクトルが1つ目の単位ベクトルと直交しない場合は、2つのベ クトルのかわりに両ベクトルを含む平面内で直交するよう変換したベクトルを 使用する。 3D Matrix to transform uvecx to be x-axis and uvecy to be y-axis. If uvecx and uvecy does not cross at right angle, uvecy will be transformed.

引数
uvecxUnit vector 1 for x axis.
uvecyUnit vector 2 for y axis.
MGMatrix& MGMatrix::set_xy_vector ( const MGUnit_vector uvecx,
const MGUnit_vector uvecy 
)

X軸、Y軸を各々、与えられた2つの単位ベクトルにするよう原点の周りに 回転させる 3D Matrix を生成し,自身のMatrixと入れ替える。もし、 2つ目の単位ベクトルが1つ目の単位ベクトルと直交しない場合は、2つのベ クトルのかわりに両ベクトルを含む平面内で直交するよう変換したベクトルを 使用する。 3D matrix to transform x and y axis to be uvecx and uvecy. This is the inverse matrix of set_xy_axis(). If uvecy does not cross uvecx at right angle, uvecy is transformed to do so.

引数
uvecxUnit vector 1 for x axis.
uvecyUnit vector 2 for y axis.
MGMatrix& MGMatrix::to_axis ( const MGUnit_vector uvec,
int  axis = 0 
)

Construct a matrix to transform a vector 'uvec' to be one of the axises, and replace own matrix. Inverse matrix of from_axis. axis can be any number(can be more than 2).

引数
uvecUnit vector to be an axis.
axisAxis kind 0:x, 1:y, 2:z, ...
MGMatrix MGMatrix::transpose ( ) const

転置Matrixを生成。 Transpose matrix.

フレンドと関連関数の詳解

MG_DLL_DECLR friend MGMatrix operator* ( double  scale,
const MGMatrix mat 
)
friend

自身のMatrixと与えられたscaleの乗算を行いオブジェクトを生成。 Scaling of the matrix.

MG_DLL_DECLR friend std::ostream& operator<< ( std::ostream &  ,
const MGMatrix  
)
friend

String stream Function.


このクラス詳解は次のファイルから抽出されました: