Skip to content

Commit d6ad80f

Browse files
authored
Merge pull request #88 from WIAS-PDELib/fix/rot2d
Fix coordinate transformation for 1D slice plots
2 parents eaa3c7c + c0ab6ed commit d6ad80f

File tree

4 files changed

+21
-7
lines changed

4 files changed

+21
-7
lines changed

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

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "GridVisualize"
22
uuid = "5eed8a63-0fb0-45eb-886d-8d5a387d12b8"
3-
version = "1.15.1"
3+
version = "1.15.2"
44
authors = ["Juergen Fuhrmann <[email protected]>", "Patrick Jaap <[email protected]>"]
55

66
[deps]

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)