diff --git a/CairoMakie/src/primitives.jl b/CairoMakie/src/primitives.jl index 4cf37ea8b7c..267b48aa210 100644 --- a/CairoMakie/src/primitives.jl +++ b/CairoMakie/src/primitives.jl @@ -362,6 +362,7 @@ function draw_atomic_scatter( markersize, strokecolor, strokewidth, m, mo, rotation isnan(pos) && return + isnan(rotation) && return # matches GLMakie scale = project_scale(scene, markerspace, markersize, size_model) offset = project_scale(scene, markerspace, mo, size_model) @@ -372,7 +373,7 @@ function draw_atomic_scatter( # Setting a markersize of 0.0 somehow seems to break Cairos global state? # At least it stops drawing any marker afterwards # TODO, maybe there's something wrong somewhere else? - if !(norm(scale) ≈ 0.0) + if !(isnan(scale) || norm(scale) ≈ 0.0) if m isa Char draw_marker(ctx, m, best_font(m, font), pos, scale, strokecolor, strokewidth, offset, rotation) else @@ -1254,7 +1255,7 @@ function draw_atomic(scene::Scene, screen::Screen, @nospecialize(primitive::Maki scale = Makie.voxel_size(primitive) colors = Makie.voxel_colors(primitive) marker = GeometryBasics.normal_mesh(Rect3f(Point3f(-0.5), Vec3f(1))) - + # Face culling if !isempty(primitive.clip_planes[]) && Makie.is_data_space(primitive.space[]) valid = [is_visible(primitive.clip_planes[], p) for p in pos] diff --git a/ReferenceTests/src/tests/attributes.jl b/ReferenceTests/src/tests/attributes.jl index c045cc717f3..fd5483748b9 100644 --- a/ReferenceTests/src/tests/attributes.jl +++ b/ReferenceTests/src/tests/attributes.jl @@ -5,3 +5,13 @@ scatter(fig[1, 2], RNG.randn(20), color=colors, markersize=10, visible=false) fig end + +@reference_test "(mesh)scatter with NaN rotation and markersize" begin + scene = Scene(size = (150, 300)) + xs = [-0.6, 0.0, 0.6] + scatter!(scene, xs, fill( 0.75, 3), marker = :ltriangle, rotation = [0.5, NaN, -0.5], markersize = 50) + scatter!(scene, xs, fill( 0.25, 3), marker = :ltriangle, markersize = [50, NaN, 50]) + meshscatter!(scene, xs, fill(-0.25, 3), marker = Rect2f(-0.5,-0.5,1,1), rotation = [0.5, NaN, -0.5], markersize = 0.2) + meshscatter!(scene, xs, fill(-0.75, 3), marker = Rect2f(-0.5,-0.5,1,1), markersize = [0.2, NaN, 0.2]) + scene +end \ No newline at end of file diff --git a/src/utilities/quaternions.jl b/src/utilities/quaternions.jl index 917bf21690b..59d6204a942 100644 --- a/src/utilities/quaternions.jl +++ b/src/utilities/quaternions.jl @@ -157,6 +157,8 @@ function quaternion_to_2d_angle(quat::Quaternion) end Base.isinf(q::Quaternion) = any(isinf, q.data) +Base.isnan(q::Quaternion) = any(isnan, q.data) +Base.isfinite(q::Quaternion) = all(isfinite, q.data) Base.abs2(q::Quaternion) = mapreduce(*, +, q.data, q.data) function Base.inv(q::Quaternion) if isinf(q)