This graph shows which files directly or indirectly include this file:

Go to the source code of this file.
Defines | |
| #define | _NORMALS_H_ |
Functions | |
| double | vectorLength (float vector[3]) |
| void | normalize (float normalVector[3]) |
| void | crossProduct (float point1[3], float point2[3], float point3[3], float normal[3]) |
| void crossProduct | ( | float | point1[3], | |
| float | point2[3], | |||
| float | point3[3], | |||
| float | normal[3] | |||
| ) |
Definition at line 24 of file normals.cpp.
Referenced by Terrain::CalcNormals().
00024 { 00025 float vector1[3], vector2[3]; 00026 00027 vector1[0] = point1[0] - point2[0]; 00028 vector1[1] = point1[1] - point2[1]; 00029 vector1[2] = point1[2] - point2[2]; 00030 00031 vector2[0] = point2[0] - point3[0]; 00032 vector2[1] = point2[1] - point3[1]; 00033 vector2[2] = point2[2] - point3[2]; 00034 00035 normal[0] = vector1[1]*vector2[2] - vector1[2]*vector2[1]; 00036 normal[1] = vector1[2]*vector2[0] - vector1[0]*vector2[2]; 00037 normal[2] = vector1[0]*vector2[1] - vector1[1]*vector2[0]; 00038 }
| void normalize | ( | float | normalVector[3] | ) |
Definition at line 14 of file normals.cpp.
References vectorLength().
Referenced by Terrain::CalcNormals(), and Terrain::CalcNormals2().
00014 { 00015 double length; 00016 00017 length = vectorLength(normalVector); 00018 00019 for (int x = 0; x < 3; x++) { 00020 normalVector[x] /=length; 00021 } 00022 }
| double vectorLength | ( | float | vector[3] | ) |
Definition at line 8 of file normals.cpp.
Referenced by normalize().
00008 { 00009 return sqrt((vector[0]*vector[0]) + 00010 (vector[1]*vector[1]) + 00011 (vector[2]*vector[2])); 00012 }
1.4.7