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