add missing

This commit is contained in:
Ryan Oldenburg 2020-11-30 00:50:07 -06:00
parent a307f89589
commit 19c9ef1b0b
2 changed files with 29 additions and 0 deletions

View file

@ -1202,6 +1202,19 @@ proc `*`*(q: Quat, v: float32): Quat {.inline.} =
result.z = q.z * v
result.w = q.w * v
proc `/`*(q: Quat, v: float32): Quat {.inline.} =
## Divide the quaternion by a float32.
result.x = q.x / v
result.y = q.y / v
result.z = q.z / v
result.w = q.w / v
proc `*=`*(a: var Quat, b: float32) {.inline.} =
a = a * b
proc `/=`*(a: var Quat, b: float32) {.inline.} =
a = a / b
proc `*`*(q: Quat, v: Vec3): Vec3 =
## Multiply the quaternion by a vector.
let

View file

@ -1,5 +1,21 @@
import vmath, osproc, random, streams
var v2 = vec2(0, 0)
v2 *= 1
v2 /= 1
var v3 = vec3(0, 0, 0)
v3 *= 1
v3 /= 1
var v4 = vec4(0, 0, 0, 0)
v4 *= 1
v4 /= 1
var q = quat(0, 0, 0, 0)
q *= 1
q /= 1
var s = newFileStream("tests/test-output.txt", fmWrite)
randomize(1234)