Skip to content

Instantly share code, notes, and snippets.

@andyferris
Last active May 3, 2016 05:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andyferris/37121de1f6cb9cd7816237a08b6546cf to your computer and use it in GitHub Desktop.
Save andyferris/37121de1f6cb9cd7816237a08b6546cf to your computer and use it in GitHub Desktop.
Quaternion refactor seperating algebraic and geometric properties
module Quaternions
# This is a type of number
immutable Quaternion{T <: Real} <: Number
s::T
x::T
y::T
z::T
end
# constructors, operations, etc.
# +, -, *, /, etc as standard quaternion algebra - no geometry insinuations.
# This object is all about geometry, and not a number per-se.
immutable RotationQuaternion{T <: Real} # not sure about this name
q::Quaternion{T}
norm::Bool # May or may not be implemented this way...
end
# constructors, etc
# inv, *, /, \ as inverse or composed RotationQuaternion.
# *, \ on vectors to apply rotations to vectors
end #module
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment