Skip to content

Commit

Permalink
fix test variations
Browse files Browse the repository at this point in the history
  • Loading branch information
ffreyer committed Dec 13, 2024
1 parent 18bd1ab commit 0faa169
Showing 1 changed file with 37 additions and 27 deletions.
64 changes: 37 additions & 27 deletions ReferenceTests/src/tests/primitives.jl
Original file line number Diff line number Diff line change
Expand Up @@ -225,36 +225,46 @@ end
s
end

# Circle and Rect have different paths in CairoMakie
for (marker, name) in zip(
['L', Rect, Circle, :utriangle, Makie.FileIO.load(Makie.assetpath("cow.png"))],
["Char", "Rect", "Circle", "BezierPath", "image"])

@reference_test "scatter Billboard and transform_marker for $name markers" begin
r = Rect3f(Point3f(-0.5), Vec3f(1))
ps = coordinates(r)
phis = collect(range(0, 2pi, length = 8))
quats = Makie.to_rotation(phis)

fig = Figure(size = (500, 800))
for (k, transform_marker) in zip(0:1, [true, false])
for (i, space, ms) in zip(1:2, [:data, :pixel], [1, 30])
for (j, rot, lbl) in zip(1:3, [Billboard(phis), phis, quats], ["Billboard", "angles", "Quaternion"])
Label(fig[i+2k, j][1,1], "$space | $lbl | $transform_marker", tellwidth = false)
a, p = scatter(fig[i+2k, j][2,1], ps, marker = marker,
strokewidth = 2, strokecolor = :black, color = :yellow,
markersize = ms, markerspace = space, rotation = rot,
transform_marker = transform_marker)

Makie.rotate!(p, Vec3f(1, 0.5, 0.1), 1.0)
a.scene.camera_controls.settings[:center] = false
Makie.update_cam!(a.scene, r)
end
function make_billboard_rotations_test_fig(marker)
r = Rect3f(Point3f(-0.5), Vec3f(1))
ps = coordinates(r)
phis = collect(range(0, 2pi, length = 8))
quats = Makie.to_rotation(phis)

fig = Figure(size = (500, 800))
for (k, transform_marker) in zip(0:1, [true, false])
for (i, space, ms) in zip(1:2, [:data, :pixel], [1, 30])
for (j, rot, lbl) in zip(1:3, [Billboard(phis), phis, quats], ["Billboard", "angles", "Quaternion"])
Label(fig[i+2k, j][1,1], "$space | $lbl | $transform_marker", tellwidth = false)
a, p = scatter(fig[i+2k, j][2,1], ps, marker = marker,
strokewidth = 2, strokecolor = :black, color = :yellow,
markersize = ms, markerspace = space, rotation = rot,
transform_marker = transform_marker)

Makie.rotate!(p, Vec3f(1, 0.5, 0.1), 1.0)
a.scene.camera_controls.settings[:center] = false
Makie.update_cam!(a.scene, r)
end
end

fig
end

fig
end

@reference_test "scatter Billboard and transform_marker for Char markers" begin
make_billboard_rotations_test_fig('L')
end
@reference_test "scatter Billboard and transform_marker for Rect markers" begin
make_billboard_rotations_test_fig(Rect)
end
@reference_test "scatter Billboard and transform_marker for Circle markers" begin
make_billboard_rotations_test_fig(Circle)
end
@reference_test "scatter Billboard and transform_marker for BezierPath markers" begin
make_billboard_rotations_test_fig(:utriangle)
end
@reference_test "scatter Billboard and transform_marker for image markers" begin
make_billboard_rotations_test_fig(Makie.FileIO.load(Makie.assetpath("cow.png")))
end

@reference_test "scatter with stroke" begin
Expand Down

0 comments on commit 0faa169

Please sign in to comment.