|
@@ -275,7 +275,8 @@ to_ptr :: proc{vector_to_ptr, matrix_to_ptr}
|
|
vector_angle_between :: proc "contextless" (a, b: $V/[$N]$E) -> E {
|
|
vector_angle_between :: proc "contextless" (a, b: $V/[$N]$E) -> E {
|
|
a0 := normalize0(a)
|
|
a0 := normalize0(a)
|
|
b0 := normalize0(b)
|
|
b0 := normalize0(b)
|
|
- return math.acos(dot(a0, b0))
|
|
|
|
|
|
+ d := clamp(dot(a0, b0), -1, +1)
|
|
|
|
+ return math.acos(d)
|
|
}
|
|
}
|
|
quaternion64_angle_between :: proc "contextless" (a, b: $Q/quaternion64) -> f16 {
|
|
quaternion64_angle_between :: proc "contextless" (a, b: $Q/quaternion64) -> f16 {
|
|
c := normalize0(conj(a) * b)
|
|
c := normalize0(conj(a) * b)
|