Skip to content

Commit 117da61

Browse files
committed
Merge branch 'main' into fix/repeatedplots
2 parents d6684d6 + d6ad80f commit 117da61

3 files changed

Lines changed: 20 additions & 6 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Changelog
22

3+
## [1.15.2] - 2025-06-24
4+
- fixed a corner case in `compute_2d_rotation_matrix` leading to wrong coordinate transformation in 1D slice plots
5+
36
## [1.15.1] - 2025-06-22
47
- Allow for Makie 0.24 and Triangulate 3.0
58

src/slice_plots.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,11 @@ function compute_2d_rotation_matrix(target_vector)
173173
# solve non-linear system for α
174174
α = asin(t[1])
175175

176+
# check second condition and rotate in the other direction if necessary
177+
if !(cos(α) t[2])
178+
α = π - α
179+
end
180+
176181
return R(α)
177182
end
178183

test/test_slice_plots.jl

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,18 @@ end
7979
t = [0, 1]
8080
@test GridVisualize.compute_2d_rotation_matrix(t) I
8181

82-
# random test
83-
t = [0.3543579344795591, 0.21250427156069385]
84-
R = GridVisualize.compute_2d_rotation_matrix(t)
85-
86-
# test rotation property
87-
@test R't [0, 1]
82+
# random tests
83+
for t in [
84+
[0.3543579344795591, 0.21250427156069385],
85+
[1.0, 1.0],
86+
[1.0, -1.0],
87+
[-1.0, 1.0],
88+
[-1.0, -1.0],
89+
]
90+
R = GridVisualize.compute_2d_rotation_matrix(t)
91+
# test rotation property
92+
@test R't [0, 1]
93+
end
8894
end
8995

9096

0 commit comments

Comments
 (0)