Skip to content

Commit 989dbaa

Browse files
committed
Fix coordinate transformation for 1D slice plots
1 parent 2171b03 commit 989dbaa

File tree

4 files changed

+30
-6
lines changed

4 files changed

+30
-6
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
# Changelog
2+
3+
## [1.15.1] - 2025-06-25
4+
5+
### Fixed
6+
7+
- fixed a corner case in `compute_2d_rotation_matrix` leading to wrong coordinate transformation in 1D slice plots
8+
29
## [1.15.0] - 2025-06-17
310
- Removed automatic overrides of user-supplied keywords `clear` , `show`, and `reveal` in `scalarplot!`, `vectorplot!`, `streamplot!`, and `customplot!`.
411
- Included `CHANGELOG.md` in docs.

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.0"
3+
version = "1.15.1"
44
authors = ["Juergen Fuhrmann <juergen.fuhrmann@wias-berlin.de>", "Patrick Jaap <patrick.jaap@wias-berlin.de>"]
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: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,24 @@ 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)
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+
91+
@show t
92+
93+
R = GridVisualize.compute_2d_rotation_matrix(t)
8594

86-
# test rotation property
87-
@test R't [0, 1]
95+
@show R
96+
97+
# test rotation property
98+
@test R't [0, 1]
99+
end
88100
end
89101

90102

0 commit comments

Comments
 (0)