1
0
mirror of https://gitlab.com/MisterBiggs/SADC.jl.git synced 2025-07-28 00:51:30 +00:00

work with help from matty

This commit is contained in:
2021-08-03 22:34:30 -07:00
parent 00c2cb08cb
commit eb737cefba
3 changed files with 34 additions and 28 deletions

View File

@@ -29,7 +29,7 @@ end
function QuaternionMultiplication(l::Quaternion, r::Quaternion)
R = [
r.r r.k r.j r.i
r.r r.k -r.j r.i
-r.k r.r r.i r.j
r.j -r.i r.r r.k
-r.i -r.j -r.k r.r
@@ -45,7 +45,7 @@ Base.:*(l::Quaternion, r::Quaternion) =
Base.iterate(q::Quaternion, state = 1) =
state > 4 ? nothing : (collect(q)[state], state + 1)
Base.length(q::Quaternion) = 4
Base.collect(q::Quaternion) = [q.i q.j q.k q.r]
Base.collect(q::Quaternion) = [q.i, q.j, q.k, q.r]
Base.getindex(q::Quaternion, i) = collect(q)[i]
Base.isapprox(a::Quaternion, b::Quaternion) = isapprox(collect(a), collect(b))