7.2.10 Initialisation, création et copie de la Matrice4

Et voici les fonctions privées de la Matrice4 :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
void Matrice4::initialisationMatrice4(const Vecteur4& v1, const Vecteur4& v2, const Vecteur4& v3, const Vecteur4& v4){
	createMatrice4();
	p_mat[0] = v1.getX(); p_mat[1] = v2.getX(); p_mat[2] = v3.getX(); p_mat[3] = v4.getX();
	p_mat[4] = v1.getY(); p_mat[5] = v2.getY(); p_mat[6] = v3.getY(); p_mat[7] = v4.getY();
	p_mat[8] = v1.getZ(); p_mat[9] = v2.getZ(); p_mat[10] = v3.getZ();p_mat[11] = v4.getZ();
	p_mat[12] = v1.getT();p_mat[13] = v2.getT();p_mat[14] = v3.getT();p_mat[15] = v4.getT();
	p_sauvegardePrecedente = NULL;
}

void Matrice4::initialisationMatrice4(float x1, float y1, float z1, float t1,
				float x2, float y2, float z2, float t2,
				float x3, float y3, float z3, float t3,
				float x4, float y4, float z4, float t4){
	createMatrice4();
	p_mat[0] = x1; p_mat[1] = x2; p_mat[2] = x3; p_mat[3] = x4;
	p_mat[4] = y1; p_mat[5] = y2; p_mat[6] = y3; p_mat[7] = y4;
	p_mat[8] = z1; p_mat[9] = z2; p_mat[10] = z3;p_mat[11] = z4;
	p_mat[12] = t1;p_mat[13] = t2;p_mat[14] = t3;p_mat[15] = t4;
	p_sauvegardePrecedente = NULL;
}

void Matrice4::createMatrice4(){
	if(p_mat == NULL) p_mat = new float[16];
}

void Matrice4::copyMatrice4(const Matrice4 & other){
	createMatrice4();
	for(unsigned int i(0); i < 16; i++){
		p_mat[i] = other.p_mat[i];
	}
}

Ouf, ça, c'est fait.