00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef LUX_VECTOR_NORMAL_H
00024 #define LUX_VECTOR_NORMAL_H
00025
00026 #include "vector.h"
00027 #include "normal.h"
00028
00029 namespace lux
00030 {
00031
00032
00033 inline Vector Cross(const Vector &v1, const Normal &v2) {
00034 return Vector((v1.y * v2.z) - (v1.z * v2.y),
00035 (v1.z * v2.x) - (v1.x * v2.z),
00036 (v1.x * v2.y) - (v1.y * v2.x));
00037 }
00038
00039 inline Vector Cross(const Normal &v1, const Vector &v2) {
00040 return Vector((v1.y * v2.z) - (v1.z * v2.y),
00041 (v1.z * v2.x) - (v1.x * v2.z),
00042 (v1.x * v2.y) - (v1.y * v2.x));
00043 }
00044
00045 inline float Dot(const Normal &n1, const Vector &v2) {
00046 return n1.x * v2.x + n1.y * v2.y + n1.z * v2.z;
00047 }
00048
00049 inline float Dot(const Vector &v1, const Normal &n2) {
00050 return v1.x * n2.x + v1.y * n2.y + v1.z * n2.z;
00051 }
00052
00053 inline float AbsDot(const Vector &v1, const Normal &n2) {
00054 return fabsf(v1.x * n2.x + v1.y * n2.y + v1.z * n2.z);
00055 }
00056
00057 inline float AbsDot(const Normal &n1, const Vector &v2) {
00058 return fabsf(n1.x * v2.x + n1.y * v2.y + n1.z * v2.z);
00059 }
00060
00061 }
00062
00063 #endif // LUX_VECTOR_NORMAL_H