The Gnome Chemistry Utils 0.13.3
Public Member Functions
gcu::Matrix Class Reference

#include <gcu/matrix.h>

Inheritance diagram for gcu::Matrix:
gcu::Transform3d

List of all members.

Public Member Functions

 Matrix ()
 Matrix (double d)
 Matrix (double d[3][3])
 Matrix (Matrix const &m)
 Matrix (Vector const &v1, Vector const &v2, Vector const &v3, bool as_rows=true)
virtual ~Matrix ()
 Matrix (double Psi, double Theta, double Phi, MatrixType Type)
 Matrix (double x11, double x12, double x13, double x21, double x22, double x23, double x31, double x32, double x33)
Matrixoperator* (Matrix const &cMat) const
Matrixoperator= (Matrix const &cMat)
void Euler (double &Psi, double &Theta, double &Phi)
void Transform (double &dx, double &dy, double &dz) const
Vector operator* (Vector const &v) const
Vector glmult (Vector const &v) const
double & operator() (unsigned i, unsigned j)
double operator() (unsigned i, unsigned j) const

Detailed Description

This class provides some operations related to rotation of a solid in space. The matrices are 3x3.

Definition at line 49 of file matrix.h.


Constructor & Destructor Documentation

gcu::Matrix::Matrix ( )

Default constructor. Initialized to unit matrix.

gcu::Matrix::Matrix ( double  d)
Parameters:
da number.

Constructs a scalar matrix. Initializes diagonal elements to d and other elements to 0.

gcu::Matrix::Matrix ( double  d[3][3])
Parameters:
da table of numbers.

Constructs a matrix from the values in d.

gcu::Matrix::Matrix ( Matrix const &  m)
Parameters:
ma matrix.

Copy contructor.

gcu::Matrix::Matrix ( Vector const &  v1,
Vector const &  v2,
Vector const &  v3,
bool  as_rows = true 
)
Parameters:
v1a Vector.
v2a Vector.
v3a Vector.
as_rowswhether the Vector arguments are used as rows or columns.

Constructs a Matrix from three Vector arguments.

virtual gcu::Matrix::~Matrix ( ) [virtual]

The destructor of Matrix.

gcu::Matrix::Matrix ( double  Psi,
double  Theta,
double  Phi,
MatrixType  Type 
)
Parameters:
Psi,:precession angle.
Theta,:nutaton angle.
Phi,:rotation angle.
Type,:the type of the Matrix.

Constructs a Matrix instance starting from three angles and the type. if Type is euler or antieuler, the angles are the Euler's angles. If Type is rotation, the values have a somewhat different meaning: they are the angles describing the rotation applied to a solid; the resulting matrix is then multiplied by the current "euler" matrix to give the new euler matrix. The code used in CrystalView::Rotate and in GtkChem3DViewer code is (when mouse has moved by x and y on the screen):

        gdouble z = sqrt(x*x + y*y);
        Matrix Mat(0, (y > 0)? - acos(x/z) :acos(x/z), z * M_PI / 90., rotation);
        m_Euler = Mat * m_Euler;

The (M_PI / 90.) factor is arbitrary here.

gcu::Matrix::Matrix ( double  x11,
double  x12,
double  x13,
double  x21,
double  x22,
double  x23,
double  x31,
double  x32,
double  x33 
)
Parameters:
x11,:value to use at first line and first column of the matrix.
x12,:value to use at first line and second column of the matrix.
x13,:value to use at first line and third column of the matrix.
x21,:value to use at second line and first column of the matrix.
x22,:value to use at second line and second column of the matrix.
x23,:value to use at second line and third column of the matrix.
x31,:value to use at third line and first column of the matrix.
x32,:value to use at third line and second column of the matrix.
x33,:value to use at third line and third column of the matrix.

Constructs a matrix from its components.


Member Function Documentation

void gcu::Matrix::Euler ( double &  Psi,
double &  Theta,
double &  Phi 
)
Parameters:
Psi,:precession angle.
Theta,:nutaton angle.
Phi,:rotation angle.

Get the Euler's angles associated to a "euler" Matrix as defined in MatrixType.

Vector gcu::Matrix::glmult ( Vector const &  v) const
Parameters:
va Vector.

Multiplies v by the Matrix using OpenGL coordinates conventions.

Returns:
the result of the multiplication.
double gcu::Matrix::operator() ( unsigned  i,
unsigned  j 
) const [inline]
Parameters:
ithe row.
jthe column.

return the value at row i and column j.

Definition at line 177 of file matrix.h.

double& gcu::Matrix::operator() ( unsigned  i,
unsigned  j 
) [inline]
Parameters:
ithe row.
jthe column.

return the value at row i and column j as a reference.

Definition at line 170 of file matrix.h.

Vector gcu::Matrix::operator* ( Vector const &  v) const
Parameters:
va Vector.

Multiplies v by the Matrix.

Returns:
the result of the multiplication.

Reimplemented in gcu::Transform3d.

Matrix& gcu::Matrix::operator* ( Matrix const &  cMat) const
Parameters:
cMat,:a Matrix instance to use in the multiplication.

The matricial multiplication operator.

Matrix& gcu::Matrix::operator= ( Matrix const &  cMat)
Parameters:
cMat,:the Matrix instance to copy.

Copies a Matrix instance into another one.

void gcu::Matrix::Transform ( double &  dx,
double &  dy,
double &  dz 
) const
Parameters:
dx,:the x coordinate.
dy,:the y coordinate.
dz,:the z coordinate.

Initially, dx, dy and dz are the components of the vector to transform (multiply) by the matrix and after execution of this method, dx, dy and dz are the components of the transformed vector. So initial values are lost.


The documentation for this class was generated from the following file: