Header to include: imat.h
Imat *imodMatNew(int dim)
void imodMatDelete(Imat *mat)
void imodMatId(Imat *mat)
void imodMatPrint(Imat *mat)
void imodMatCopy(Imat *fmat, Imat *tomat)
void imodMatMult(Imat *mat2, Imat *mat1, Imat *matout)
void imodMatTrans(Imat *mat, Ipoint *pt)
int imodMatScale(Imat *mat, Ipoint *pt)
int imodMatRot(Imat *mat, double angle, int axis)
int imodMatRotateVector(Imat *mat, double angle, Ipoint *v)
int imodMatFindVector(Imat *mat, double *angle, Ipoint *v)
int imodMatGetNatAngles(Imat *mat, double *x, double *y, double *z)
void imodMatUniqueAngles(double *x, double *y, double *z)
void imodMatUniqueRotationPt(Ipoint *pt)
void imodMatTransform2D(Imat *mat, Ipoint *pt, Ipoint *rpt)
void imodMatTransform3D(Imat *mat, Ipoint *pt, Ipoint *rpt)
void imodMatTransform(Imat *mat, Ipoint *pt, Ipoint *rpt)
Imat *imodMatInverse(Imat *mat)
The Imat structure is described by:
typedef struct imodel_matrix { float *data; int dim; /* is 2D or 3D */ int size; }Imat;
Creates a new matrix structure and sets it to the identity matrix. The input dimension dim can be 2 or 3. Returns NULL for error.
Frees the matrix mat as well as its data member.
Sets the matrix mat to the identity matrix.
Prints matrix in imat.
Copies matrix fmat to tomat, provided they are the same dimension.
Forms the matrix product mat1 x mat2 and places it into matout; i.e., the input arguments are the matrix applied first and the matrix applied second.
Adds the translation in pt to the transformation in mat.
Applies scaling by the factors in pt to the transformation in mat.
Applies rotation by angle in degrees around one axis to the transformation in mat. For a 3D matrix, axis must be one of b3dX, b3dY, or b3dZ; for a 2D matrix axis is ignored. Returns 1 for memory error.
Applies a rotation by angle (in degrees) about the vector v to the matrix in mat.
Given a rotation matrix mat, finds a single rotation axis described by vector v and the amount of rotation angle about that axis, in degrees.
Given a 3D rotation matrix in mat, finds the angles of rotation about the three axes, in the order Z, Y, X, and returns them in x, y, and z. Returns 1 if the determinant of the matrix is not near zero. Angles are in degrees. Calls matrixToAngles then imodMatUniqueAngles to get a unique set of angles with restricted range.
Converts the three angles x, y, and z for rotations about the X, Y, and Z axes into a unique set of angles, with x between +/-90 and y and z between +/-180. Angles are in degrees. If x is out of bounds, it inverts the sign of z and takes the complement of y.
Calls imodMatUniqueAngles with the X, Y, and Z angles in the three members of pt.
Applies the 2D transformation in matrix mat to the point pt and returns the transformed position in rpt, which must be different from pt.
Applies the 3D transformation in matrix mat to the point pt and returns the transformed position in rpt, which must be different from pt.
Applies the transformation in matrix mat to the point pt and returns the transformed position in rpt, which must be different from pt. mat can be 2D or 3D.
Returns the inverse of the matrix mat, or NULL for memory error.