Skip to content

Commit 5c51865

Browse files
Fix rotation of Ellipsoid (#1029)
* Fix rotation of Ellipsoid * Update test/primitives.jl Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 63c475a commit 5c51865

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/transforms/rotate.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ applycoord(t::Rotate, v::Vec) = urotapply(t.rot, v)
7171

7272
applycoord(t::Rotate, b::Box) = TransformedGeometry(b, t)
7373

74+
applycoord(t::Rotate, e::Ellipsoid) = Ellipsoid(radii(e), center(e), t.rot * rotation(e))
75+
7476
applycoord(t::Rotate, g::CartesianGrid) = TransformedGrid(g, t)
7577

7678
applycoord(t::Rotate, g::RectilinearGrid) = TransformedGrid(g, t)

test/primitives.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -701,6 +701,10 @@ end
701701
equaltest(e)
702702
isapproxtest(e)
703703

704+
e = Ellipsoid((T(3), T(2), T(1)))
705+
R = RotXYZ(T/ 4), T/ 5), T/ 3))
706+
@test rotation(e |> Rotate(R)) == R
707+
704708
e = Ellipsoid((T(3), T(2), T(1)))
705709
@test sprint(show, e) ==
706710
"Ellipsoid(radii: (3.0 m, 2.0 m, 1.0 m), center: (x: 0.0 m, y: 0.0 m, z: 0.0 m), rotation: UniformScaling{Bool}(true))"

0 commit comments

Comments
 (0)