Skip to content

Commit

Permalink
fixed? motor composition by matching where motor identity should be
Browse files Browse the repository at this point in the history
  • Loading branch information
zoemcc committed Jul 14, 2023
1 parent 479081c commit 6f1f58e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/motor3D.jl
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ function Base.:(*)(a::Motor3D, b::Motor3D)
a[4] * b[2] + a[2] * b[4] + a[3] * b[1] - a[1] * b[3],
a[4] * b[3] + a[3] * b[4] + a[1] * b[2] - a[2] * b[1],
a[4] * b[4] - a[1] * b[1] - a[2] * b[2] - a[3] * b[3],
a[8] * b[3] + a[5] * b[2] - a[6] * b[1] + a[7] * b[4] + b[8] * a[3] - b[6] * a[2] + b[7] * a[1] + b[5] * a[4],
a[8] * b[1] + a[5] * b[4] + a[6] * b[3] - a[7] * b[2] + b[8] * a[1] + b[6] * a[4] - b[7] * a[3] + b[5] * a[2],
a[8] * b[2] - a[5] * b[3] + a[6] * b[4] + a[7] * b[1] + b[8] * a[2] + b[6] * a[3] + b[7] * a[4] - b[5] * a[1],
a[8] * b[4] - a[5] * b[1] - a[6] * b[2] - a[7] * b[3] + b[8] * a[4] - b[6] * a[1] - b[7] * a[2] - b[5] * a[3]
a[8] * b[3] + a[6] * b[2] - a[7] * b[1] + a[5] * b[4] + b[8] * a[3] - b[6] * a[2] + b[7] * a[1] + b[5] * a[4],
a[8] * b[1] + a[6] * b[4] + a[7] * b[3] - a[5] * b[2] + b[8] * a[1] + b[6] * a[4] - b[7] * a[3] + b[5] * a[2],
a[8] * b[2] - a[6] * b[3] + a[7] * b[4] + a[5] * b[1] + b[8] * a[2] + b[6] * a[3] + b[7] * a[4] - b[5] * a[1],
a[8] * b[4] - a[6] * b[1] - a[7] * b[2] - a[5] * b[3] + b[8] * a[4] - b[6] * a[1] - b[7] * a[2] - b[5] * a[3]
)
end
#=
Expand Down
6 changes: 3 additions & 3 deletions test/test_motor3D.jl
Original file line number Diff line number Diff line change
Expand Up @@ -94,16 +94,16 @@ end
using PGA3D, Test, SafeTestsets, Logging, PrettyPrinting, StaticArrays, Random, LinearAlgebra
@testset "Motor Identity" begin
motoridentity = identity_motor()
for i in 1:3
for i in 1:100
testfrom = Point3D(randn(3)...)
testto = Point3D(randn(3)...)
testline = line_fromto(testfrom, testto)
testangle = randn()
testdisp = randn()
testmotor = motor_screw(testline, testangle, testdisp)

#@test testmotor * motoridentity ≈ testmotor
#@test motoridentity * testmotor ≈ testmotor
@test testmotor * motoridentity testmotor
@test motoridentity * testmotor testmotor
end
end
end
Expand Down

0 comments on commit 6f1f58e

Please sign in to comment.