aboutsummaryrefslogtreecommitdiff
path: root/include/math/vec3.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/math/vec3.h')
-rw-r--r--include/math/vec3.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/include/math/vec3.h b/include/math/vec3.h
index caa212e..641c02f 100644
--- a/include/math/vec3.h
+++ b/include/math/vec3.h
@@ -98,8 +98,8 @@ static inline R vec3_dot(vec3 a, vec3 b) {
98 98
99/// Return the cross product of two vectors. 99/// Return the cross product of two vectors.
100static inline vec3 vec3_cross(vec3 a, vec3 b) { 100static inline vec3 vec3_cross(vec3 a, vec3 b) {
101 return (vec3){a.y * b.z - a.z * b.y, a.z * b.x - a.x * b.z, 101 return (vec3){
102 a.x * b.y - a.y * b.x}; 102 a.y * b.z - a.z * b.y, a.z * b.x - a.x * b.z, a.x * b.y - a.y * b.x};
103} 103}
104 104
105/// Reflect the vector about the normal. 105/// Reflect the vector about the normal.
@@ -114,8 +114,8 @@ static inline vec3 vec3_refract(vec3 v, vec3 n, R e) {
114 const R k = 1.0 - e * e * (1.0 - vec3_dot(n, v) * vec3_dot(n, v)); 114 const R k = 1.0 - e * e * (1.0 - vec3_dot(n, v) * vec3_dot(n, v));
115 assert(k >= 0); 115 assert(k >= 0);
116 // r = e*v - (e * dot(n,v) + sqrt(k)) * n 116 // r = e*v - (e * dot(n,v) + sqrt(k)) * n
117 return vec3_sub(vec3_scale(v, e), 117 return vec3_sub(
118 vec3_scale(n, e * vec3_dot(n, v) * sqrt(k))); 118 vec3_scale(v, e), vec3_scale(n, e * vec3_dot(n, v) * sqrt(k)));
119} 119}
120 120
121/// Elevate the vector to a power. 121/// Elevate the vector to a power.