Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Corrupted marker with Point2 instead of Point2f #2778

Closed
ederag opened this issue Mar 16, 2023 · 2 comments
Closed

Corrupted marker with Point2 instead of Point2f #2778

ederag opened this issue Mar 16, 2023 · 2 comments

Comments

@ederag
Copy link

ederag commented Mar 16, 2023

Instead of three hexagons (as shown in #2777; a similar code is used here), the result of

using CairoMakie
a = 0.5 # hexagon radius
vertices = [
	Point2(  # workaround: change to Point2f
		a * cos(θ),
		a * sin(θ)
	)
	for θ in range(1/6 * pi, 13/6 * pi, length = 7)
]
hexagon = Makie.Polygon(vertices)
points = a .* Point2[(0, 0), (sqrt(3), 0), (sqrt(3)/2, 1.5)]
scatter(points,
    marker = hexagon,
    markersize = 1,
    markerspace = :data,
    color = 1:3,
    axis = (; aspect = 1, limits = a .* (-2, 4, -2, 4))
)

is weird:
image

It might be related to #1419 or #2573, as it has to do with single vs double precision.
The funny thing is that here lower precision gives better results, so it might be entirely different.

Note:
This was with CairoMakie v0.10.2.

With GLMakie v0.8.2 there is an error:

Details

Failed to show value:
InexactError: trunc(Int64, NaN)
    trunc@float.jl:781[inlined]
    round@float.jl:359[inlined]
    ftvec@bezier.jl:475[inlined]
    _broadcast_getindex_evalf@broadcast.jl:670[inlined]
    _broadcast_getindex@broadcast.jl:643[inlined]
    getindex@broadcast.jl:597[inlined]
    macro expansion@broadcast.jl:961[inlined]
    macro expansion@simdloop.jl:77[inlined]
    copyto!@broadcast.jl:960[inlined]
    copyto!@broadcast.jl:913[inlined]
    copy@broadcast.jl:885[inlined]
    materialize@broadcast.jl:860[inlined]
    convert_command(::Makie.MoveTo)@bezier.jl:478
    make_outline(::Makie.BezierPath)@bezier.jl:447
    render_path(::Makie.BezierPath, ::Int64)@bezier.jl:507
    render(::Makie.TextureAtlas, ::Makie.BezierPath)@texture_atlas.jl:393
    (::Makie.var"#49#50"{Makie.TextureAtlas, Makie.BezierPath})()@texture_atlas.jl:301
    get!(::Makie.var"#49#50"{Makie.TextureAtlas, Makie.BezierPath}, ::Dict{UInt32, Int64}, ::UInt32)@dict.jl:481
    insert_glyph!@texture_atlas.jl:300[inlined]
    insert_glyph!(::Makie.TextureAtlas, ::Makie.BezierPath)@texture_atlas.jl:295
    glyph_index!@texture_atlas.jl:277[inlined]
    glyph_uv_width!@texture_atlas.jl:285[inlined]
    primitive_uv_offset_width@texture_atlas.jl:450[inlined]
    #57@texture_atlas.jl:454[inlined]
    #map#[email protected]:564[inlined]
    primitive_uv_offset_width@texture_atlas.jl:454[inlined]
    #187@drawing_primitives.jl:231[inlined]
    get!(::GLMakie.var"#187#194"{Observables.Observable{FreeTypeAbstraction.FTFont}, Makie.TextureAtlas, Observables.Observable{Makie.BezierPath}}, ::Dict{Symbol, Any}, ::Symbol)@dict.jl:481
    (::GLMakie.var"#182#189"{GLMakie.Screen{GLFW.Window}, Makie.Scene, MakieCore.Scatter{Tuple{Vector{GeometryBasics.Point{2, Float32}}}}})(::Dict{Symbol, Any})@drawing_primitives.jl:230
    (::GLMakie.var"#168#171"{GLMakie.var"#182#189"{GLMakie.Screen{GLFW.Window}, Makie.Scene, MakieCore.Scatter{Tuple{Vector{GeometryBasics.Point{2, Float32}}}}}, GLMakie.Screen{GLFW.Window}, Makie.Scene, MakieCore.Scatter{Tuple{Vector{GeometryBasics.Point{2, Float32}}}}})()@drawing_primitives.jl:111
    get!(::GLMakie.var"#168#171"{GLMakie.var"#182#189"{GLMakie.Screen{GLFW.Window}, Makie.Scene, MakieCore.Scatter{Tuple{Vector{GeometryBasics.Point{2, Float32}}}}}, GLMakie.Screen{GLFW.Window}, Makie.Scene, MakieCore.Scatter{Tuple{Vector{GeometryBasics.Point{2, Float32}}}}}, ::Dict{UInt64, GLMakie.GLAbstraction.RenderObject}, ::UInt64)@dict.jl:481
    cached_robj!(::GLMakie.var"#182#189"{GLMakie.Screen{GLFW.Window}, Makie.Scene, MakieCore.Scatter{Tuple{Vector{GeometryBasics.Point{2, Float32}}}}}, ::GLMakie.Screen{GLFW.Window}, ::Makie.Scene, ::MakieCore.Scatter{Tuple{Vector{GeometryBasics.Point{2, Float32}}}})@drawing_primitives.jl:84
    draw_atomic@drawing_primitives.jl:198[inlined]
    insert!(::GLMakie.Screen{GLFW.Window}, ::Makie.Scene, ::MakieCore.Scatter{Tuple{Vector{GeometryBasics.Point{2, Float32}}}})@drawing_primitives.jl:126
    insertplots!(::GLMakie.Screen{GLFW.Window}, ::Makie.Scene)@screen.jl:435
    insertplots!(::GLMakie.Screen{GLFW.Window}, ::Makie.Scene)@screen.jl:438
    display_scene!(::GLMakie.Screen{GLFW.Window}, ::Makie.Scene)@screen.jl:374
    var"#Screen#48"(::Nothing, ::Bool, ::Type{GLMakie.Screen}, ::Makie.Scene, ::GLMakie.ScreenConfig, ::IOContext{IOBuffer}, ::MIME{Symbol("image/png")})@screen.jl:400
    GLMakie.Screen(::Makie.Scene, ::GLMakie.ScreenConfig, ::IOContext{IOBuffer}, ::MIME{Symbol("image/png")})@screen.jl:396
    var"#getscreen#1012"(::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, ::typeof(Makie.getscreen), ::Module, ::Makie.Scene, ::IOContext{IOBuffer}, ::Vararg{Any})@display.jl:336
    getscreen@display.jl:324[inlined]
    show(::IOContext{IOBuffer}, ::MIME{Symbol("image/png")}, ::Makie.FigureAxisPlot)@display.jl:203
    show_richest(::IOContext{IOBuffer}, ::Any)@PlutoRunner.jl:1175
    show_richest_withreturned@PlutoRunner.jl:1100[inlined]
    format_output_default(::Any, ::Any)@PlutoRunner.jl:1000
    #format_output#[email protected]:1017[inlined]
    #[email protected]:909[inlined]
    var"#with_io_to_logs#115"(::Bool, ::Base.CoreLogging.LogLevel, ::typeof(Main.PlutoRunner.with_io_to_logs), ::Main.PlutoRunner.var"#53#56"{Module, Makie.FigureAxisPlot, Dict{Tuple{UInt64, Int64}, Int64}})@PlutoRunner.jl:2424
    (::Main.PlutoRunner.var"#119#120"{Bool, Base.CoreLogging.LogLevel, Main.PlutoRunner.var"#53#56"{Module, Makie.FigureAxisPlot, Dict{Tuple{UInt64, Int64}, Int64}}})()@PlutoRunner.jl:2448
    with_logstate(::Function, ::Any)@logging.jl:511
    with_logger@logging.jl:623[inlined]
    #with_logger_and_io_to_logs#[email protected]:2447[inlined]
    var"#formatted_result_of#50"(::Bool, ::typeof(Main.PlutoRunner.formatted_result_of), ::Base.UUID, ::Base.UUID, ::Bool, ::Vector{String}, ::Nothing, ::Module)@PlutoRunner.jl:908
    top-level scope@WorkspaceManager.jl:527

@ffreyer
Copy link
Collaborator

ffreyer commented May 24, 2024

Fixed in Makie 0.21, possibly by #3681

@ederag
Copy link
Author

ederag commented May 24, 2024

Confirmed, thanks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

2 participants