Last active
May 3, 2016 05:45
-
-
Save andyferris/37121de1f6cb9cd7816237a08b6546cf to your computer and use it in GitHub Desktop.
Quaternion refactor seperating algebraic and geometric properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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