1
0
mirror of https://gitlab.com/MisterBiggs/astro-helper.git synced 2025-08-02 11:21:23 +00:00

added quaternion from ypr

This commit is contained in:
2021-01-20 21:31:12 -07:00
parent a10e6399b1
commit 9a1cfd433f
2 changed files with 16 additions and 6 deletions

View File

@@ -1,12 +1,21 @@
using AstroHelper
using Test
import AstroHelper: Quaternion
import AstroHelper
@testset "Quaternion Initialization" begin
@test Quaternion().r == 1.0
@test Quaternion([0,0,0,1]) == Quaternion(0, 0, 0, 1)
@test Quaternion([0 0 0], 0) == Quaternion(0, 0, 0, 1)
@test Quaternion([0,0,0,1]) == Quaternion()
@test Quaternion([0 0 0], 0) == Quaternion()
@test Quaternion([1 -2 2], (-2 * pi / 3)) Quaternion([-sqrt(3) / 6, sqrt(3) / 3, -sqrt(3) / 3, 1 / 2])
# Roll of pi/2
@test Quaternion(0, 0, pi / 2) Quaternion([1 0 0], pi / 2)
@test_throws ErrorException Quaternion(1, 2, 3, 4)
end
@testset "Quaternion Math" begin
# Quaternion Multiplication is not Communitive.
# @test Quaternion() * Quaternion([0 1 0 0]) != Quaternion([0 1 0 0]) * Quaternion()
end