mirror of https://github.com/aap/librw.git
transpose for rwio normal xform
This commit is contained in:
parent
8fc446f13b
commit
efec4e5acc
21
src/base.cpp
21
src/base.cpp
|
@ -214,6 +214,27 @@ Matrix::invert(Matrix *dst, Matrix *src)
|
||||||
return dst;
|
return dst;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// transpose the 3x3 submatrix, pos is set to 0
|
||||||
|
Matrix*
|
||||||
|
Matrix::transpose(Matrix *dst, Matrix *src)
|
||||||
|
{
|
||||||
|
if(src->flags & IDENTITY)
|
||||||
|
*dst = *src;
|
||||||
|
dst->right.x = src->right.x;
|
||||||
|
dst->up.x = src->right.y;
|
||||||
|
dst->at.x = src->right.z;
|
||||||
|
dst->right.y = src->up.x;
|
||||||
|
dst->up.y = src->up.y;
|
||||||
|
dst->at.y = src->up.z;
|
||||||
|
dst->right.z = src->at.x;
|
||||||
|
dst->up.z = src->at.y;
|
||||||
|
dst->at.z = src->at.z;
|
||||||
|
dst->pos.x = 0.0;
|
||||||
|
dst->pos.y = 0.0;
|
||||||
|
dst->pos.z = 0.0;
|
||||||
|
return dst;
|
||||||
|
}
|
||||||
|
|
||||||
Matrix*
|
Matrix*
|
||||||
Matrix::rotate(V3d *axis, float32 angle, CombineOp op)
|
Matrix::rotate(V3d *axis, float32 angle, CombineOp op)
|
||||||
{
|
{
|
||||||
|
|
|
@ -227,6 +227,7 @@ struct Matrix
|
||||||
void update(void) { flags &= ~(IDENTITY|TYPEMASK); }
|
void update(void) { flags &= ~(IDENTITY|TYPEMASK); }
|
||||||
static Matrix *mult(Matrix *dst, Matrix *src1, Matrix *src2);
|
static Matrix *mult(Matrix *dst, Matrix *src1, Matrix *src2);
|
||||||
static Matrix *invert(Matrix *m1, Matrix *m2);
|
static Matrix *invert(Matrix *m1, Matrix *m2);
|
||||||
|
static Matrix *transpose(Matrix *m1, Matrix *m2);
|
||||||
Matrix *rotate(V3d *axis, float32 angle, CombineOp op);
|
Matrix *rotate(V3d *axis, float32 angle, CombineOp op);
|
||||||
Matrix *rotate(const Quat &q, CombineOp op);
|
Matrix *rotate(const Quat &q, CombineOp op);
|
||||||
Matrix *translate(V3d *translation, CombineOp op);
|
Matrix *translate(V3d *translation, CombineOp op);
|
||||||
|
@ -240,10 +241,6 @@ struct Matrix
|
||||||
static Matrix *invertGeneral(Matrix *dst, Matrix *src);
|
static Matrix *invertGeneral(Matrix *dst, Matrix *src);
|
||||||
static void makeRotation(Matrix *dst, V3d *axis, float32 angle);
|
static void makeRotation(Matrix *dst, V3d *axis, float32 angle);
|
||||||
static void makeRotation(Matrix *dst, const Quat &q);
|
static void makeRotation(Matrix *dst, const Quat &q);
|
||||||
/*
|
|
||||||
bool32 isIdentity(void);
|
|
||||||
static void transpose(Matrix *m1, Matrix *m2);
|
|
||||||
*/
|
|
||||||
private:
|
private:
|
||||||
float32 normalError(void);
|
float32 normalError(void);
|
||||||
float32 orthogonalError(void);
|
float32 orthogonalError(void);
|
||||||
|
|
Loading…
Reference in New Issue