Skip to content

Commit 72dcfe1

Browse files
authored
Fix Rotate of Ellipsoid (#1030)
* Fix Rotate of Ellipsoid * Improve test
1 parent 70ffc90 commit 72dcfe1

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

src/transforms/rotate.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ 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))
74+
applycoord(t::Rotate, e::Ellipsoid) = Ellipsoid(radii(e), applycoord(t, center(e)), t.rot * rotation(e))
7575

7676
applycoord(t::Rotate, g::CartesianGrid) = TransformedGrid(g, t)
7777

test/primitives.jl

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -701,10 +701,6 @@ 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-
708704
e = Ellipsoid((T(3), T(2), T(1)))
709705
@test sprint(show, e) ==
710706
"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))"

test/transforms.jl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,17 @@
136136
@test r Cylinder(cart(0, 0, 0), cart(1, 0, 0))
137137
@test TB.revert(f, r, c) g
138138

139+
# ----------
140+
# ELLIPSOID
141+
# ----------
142+
143+
R = RotXYZ(T/ 4), T/ 5), T/ 3))
144+
f = Rotate(R)
145+
g = Ellipsoid((T(3), T(2), T(1)), (T(1), T(1), T(1)))
146+
r, c = TB.apply(f, g)
147+
@test center(r) == center(g) |> Rotate(R)
148+
@test rotation(r) == R
149+
139150
# ---------
140151
# POINTSET
141152
# ---------

0 commit comments

Comments
 (0)