MGCL V10
V10
MGCL V10
|
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 () | |
MGMatrix & | operator= (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 |
MGMatrix & | operator*= (double) |
MGMatrix | operator* (const MGMatrix &) const |
MGMatrix & | operator*= (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 |
行列式の値を返却。 [詳解] | |
MGMatrix & | from_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. [詳解] | |
MGMatrix & | reflection (const MGVector &vec) |
void | resize (int nsdim) |
int | sdim () const |
Return space dimension. [詳解] | |
MGMatrix & | set_x_axis (const MGUnit_vector &unit) |
MGMatrix & | set_reflect_2D (const MGVector &) |
MGMatrix & | set_rotate_2D (double angle) |
MGMatrix & | set_rotate_2D (double cval, double sval) |
MGMatrix & | set_axis (const MGUnit_vector &uvec, int axis=0) |
MGMatrix & | set_vector (const MGUnit_vector &uvec, int axis=0) |
MGMatrix & | set_xy_axis (const MGUnit_vector &uvecx, const MGUnit_vector &uvecy) |
MGMatrix & | set_xy_vector (const MGUnit_vector &uvecx, const MGUnit_vector &uvecy) |
MGMatrix & | set_reflect_3D (const MGVector &vec) |
MGMatrix & | set_rotate (const MGVector &V0, const MGVector &V1) |
MGMatrix & | set_rotate_3D (const MGVector &vec, double angle) |
MGMatrix & | set_rotate_3D (const MGVector &vec, double cval, double sval) |
MGMatrix & | set_scale (double) |
MGMatrix & | set_diff_scale (double *) |
MGMatrix & | set_glMatrix (const double glMat[16]) |
Set up this matrix from OpenGL matrix. [詳解] | |
void | set_null () |
Set this as a null matrix. [詳解] | |
MGMatrix | transpose () const |
MGMatrix & | to_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)
|
explicit |
void constructor:void コンストラクタ When sdim>=1, MGMatrix is initialized as a unit matrix.
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.
dim | dimension of the matrix. |
values | array of values[dim*dim]. |
column_wise | If 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).
dim | Space dimension(can be more than 3). |
axis1 | axis number 1 |
axis2 | axis number 2 |
cosv | cosv=cos(angle), |
sinv | sinv=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.
|
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).
uvec | Unit vector for an axis. |
axis | Axis kind 0:x, 1:y, 2:z, ... |
|
inline |
Test if this is null.
bool MGMatrix::operator!= | ( | const MGMatrix & | ) | const |
|
inline |
Reference (i,j)-th element.
|
inline |
Access to (i,j)-th element.
MGMatrix MGMatrix::operator* | ( | double | ) | const |
自身のMatrixと与えられたscaleの乗算を行いオブジェクトを生成。 Scaling of the matrix.
自身のMatrixと与えられたMatrixの乗算を行いオブジェクトを生成。 Matrix and matrix multiplication.
自身のMatrixと与えられたTransfの乗算を行いオブジェクトを生成。 Matrix and Transf multiplication.
MGMatrix& MGMatrix::operator*= | ( | double | ) |
自身のMatrixと与えられたscaleの乗算し自身のMatrixとする。 Scaling of the matrix.
自身のMatrixと与えられたMatrixの乗算し自身のMatrixとする。 Matrix and matrix multiplication.
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.
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.
|
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.
uvec | Unit vector to be an axis. |
axis | Axis 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.
原点を通り、指定Vectorに関して鏡面変換する 2D Matrixを作成し, 既存のMatrixと入れ換える。 Mirror reflection 2D matrix about a vector through origin.
原点を通り、指定Vectorに垂直な平面に関して鏡面変換する 3D Matrix を既存のMatrixと入れ換える。 3D mirror reflection matrix about a plane whose normal is vec and passes through the origin.
(原点を基点とする)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).
与えられたVector回りに指定の角度回転させる3D Matrixを作成し既存の Matrixと入れ換える。 3D rotation matrix around vec.
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.
uvec | Unit vector for an axis. |
axis | Axis 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.
unit | unit 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.
uvecx | Unit vector 1 for x axis. |
uvecy | Unit 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.
uvecx | Unit vector 1 for x axis. |
uvecy | Unit 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).
uvec | Unit vector to be an axis. |
axis | Axis kind 0:x, 1:y, 2:z, ... |
MGMatrix MGMatrix::transpose | ( | ) | const |
転置Matrixを生成。 Transpose matrix.
自身のMatrixと与えられたscaleの乗算を行いオブジェクトを生成。 Scaling of the matrix.
|
friend |
String stream Function.