Skip to content

Commit

Permalink
Merge pull request #210 from ferrolho/hf/compat-Rotations
Browse files Browse the repository at this point in the history
Renames `UnitQuaternion` to `QuatRotation`
  • Loading branch information
rdeits authored Dec 6, 2021
2 parents da427dd + 28945fa commit e8cd09a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/MeshCat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ using GeometryBasics: GeometryBasics,
widths

using CoordinateTransformations
using Rotations: rotation_between, Rotation, RotMatrix, UnitQuaternion
using Rotations: params, rotation_between, Rotation, RotMatrix, QuatRotation
using Colors: Color, Colorant, RGB, RGBA, alpha, hex, red, green, blue
using StaticArrays: StaticVector, SVector, SDiagonal, SMatrix
using Parameters: @with_kw
Expand Down
2 changes: 1 addition & 1 deletion src/arrow_visualizer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function settransform!(vis::ArrowVisualizer, base::Point{3}, vec::Vec{3};
rotation = if vec_length > eps(T)
rotation_between(SVector(0., 0., 1.), vec)
else
one(UnitQuaternion{Float64})
one(QuatRotation{Float64})
end |> LinearMap

vis_tform = Translation(base) rotation
Expand Down
9 changes: 6 additions & 3 deletions src/atframe.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,12 @@ function getclip!(animation::Animation, path::Path)
end

js_quaternion(m::AbstractMatrix) = js_quaternion(RotMatrix(SMatrix{3, 3, eltype(m)}(m)))
js_quaternion(q::UnitQuaternion) = [q.x, q.y, q.z, q.w]
js_quaternion(::UniformScaling) = js_quaternion(UnitQuaternion(1., 0., 0., 0.))
js_quaternion(r::Rotation) = js_quaternion(UnitQuaternion(r))
function js_quaternion(q::QuatRotation)
w, x, y, z = params(q)
return [x, y, z, w]
end
js_quaternion(::UniformScaling) = js_quaternion(QuatRotation(1., 0., 0., 0.))
js_quaternion(r::Rotation) = js_quaternion(QuatRotation(r))
js_quaternion(tform::Transformation) = js_quaternion(transform_deriv(tform, SVector(0., 0, 0)))

function js_scaling(tform::AbstractAffineMap)
Expand Down

0 comments on commit e8cd09a

Please sign in to comment.