Exemplo n.º 1
0
#include "stdafx.h"
#include "Matrix3.h"
Matrix3f::Matrix3f(){
	m3[0][0] = 1;	m3[0][1] = 0;	m3[0][2] = 0;
	m3[1][0] = 0;	m3[1][1] = 1;	m3[1][2] = 0;
	m3[2][0] = 0;	m3[2][1] = 0;	m3[2][2] = 1;
}

Matrix3f Matrix3f::Identity(){
	Matrix3f T;
	T.m3[0][0] = 1;	T.m3[0][1] = 0;	T.m3[0][2] = 0;
	T.m3[1][0] = 0;	T.m3[1][1] = 1;	T.m3[1][2] = 0;
	T.m3[2][0] = 0;	T.m3[2][1] = 0;	T.m3[2][2] = 1;
	return T;
}
Matrix3f Matrix3f::SetupRotateX(float a_Angle){
	Matrix3f T;
	T.m3[1][1] = cosf(a_Angle);
	T.m3[1][2] = sinf(a_Angle);
	T.m3[2][1] = -sinf(a_Angle);
	T.m3[2][2] = cosf(a_Angle);
	return T;
}
Matrix3f Matrix3f::SetupRotateY(float a_Angle){
	Matrix3f T;
	T.m3[0][0] = cosf(a_Angle);
	T.m3[2][0] = sinf(a_Angle);
	T.m3[0][2] = -sinf(a_Angle);
	T.m3[2][2] = cosf(a_Angle);
	return T;
}
Matrix3f Matrix3f::SetupRotateZ(float a_Angle){
	Matrix3f T;
	T.m3[0][0] = cosf(a_Angle);
	T.m3[0][1] = sinf(a_Angle);
	T.m3[1][0] = -sinf(a_Angle);
	T.m3[1][1] = cosf(a_Angle);
	return T;
}
Matrix3f Matrix3f::SetupRotateXYZ(float a_Xangle, float a_Yangle, float a_Zangle){
	Matrix3f rx; Matrix3f ry; Matrix3f rz;
	rx = SetupRotateX(a_Xangle);
	ry = SetupRotateY(a_Yangle);
	rz = SetupRotateZ(a_Zangle);
	Matrix3f T = rx*ry*rz;
	return T;
}
Matrix3f Matrix3f::SetupRotateXYZ(Vector3f a_Vector3f){
	return Matrix3f::SetupRotateXYZ(a_Vector3f.x, a_Vector3f.y, a_Vector3f.z);
}
Matrix3f Matrix3f::SetupScale(Vector3f a_Scale){
	Matrix3f T;
	T.Identity();
	T.m3[0][0] = a_Scale.x;
	T.m3[1][1] = a_Scale.y;
	T.m3[2][2] = a_Scale.z;
	return T;
}/*
Matrix3f Matrix3f::SetupTranslation(Vector2f a_Trans){
	Matrix3f T;
	T.Identity();
	T.m3[0][2] = a_Trans.x;
	T.m3[1][2] = a_Trans.y;
	T.m3[2][2] = 1;
	return T;
}*/
Matrix3f Matrix3f::SetupTranslation(Vector3f a_Trans){
	Matrix3f T;
	T.Identity();
	T.m3[0][2] = a_Trans.x;
	T.m3[1][2] = a_Trans.y;
	T.m3[2][2] = a_Trans.z;
	return T;
}
Exemplo n.º 2
0
Matrix3f Matrix3f::SetupScale(Vector3f a_Scale){
	Matrix3f T;
	T.Identity();
	T.m3[0][0] = a_Scale.x;
	T.m3[1][1] = a_Scale.y;
	T.m3[2][2] = a_Scale.z;
	return T;
}/*