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

fix 2D assumption in point-based convert_args for lines #4585

Merged
merged 4 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Changelog

## [Unreleased]

- Fix an error in `convert_arguments` for PointBased plots and 3D polygons [#4585](https://github.com/MakieOrg/Makie.jl/pull/4585).
- Fix polygon rendering issue of `crossbar(..., show_notch = true)` in CairoMakie [#4587](https://github.com/MakieOrg/Makie.jl/pull/4587).

## [0.21.16] - 2024-11-06
Expand Down
2 changes: 1 addition & 1 deletion src/conversions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ function convert_arguments(PB::PointBased, mp::Union{Array{<:Polygon{N, T}}, Mul
converted = convert_arguments(PB, mp[idx])[1] # this should always be a Tuple{<: Vector{Point}}
append!(arr, converted)
if idx != n # don't add NaN at the end
push!(arr, Point2(NaN))
push!(arr, Point{N, float_type(T)}(NaN))
end
end
return (arr,)
Expand Down
4 changes: 4 additions & 0 deletions test/convert_arguments.jl
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ Makie.convert_arguments(::PointBased, ::MyConvVector) = ([Point(10, 20)],)
geom = Sphere(Point3{T_in}(0), T_in(1))
_mesh = GeometryBasics.mesh(rect3; pointtype=Point3{T_in}, facetype=GLTriangleFace)
polygon = Polygon(Point2.(xs, ys))
polygon3d = Polygon(Point3.(xs, ys, zs))
line = LineString(Point3.(xs, ys, zs))
bp = BezierPath([
MoveTo(T_in(0), T_in(0)),
Expand Down Expand Up @@ -228,6 +229,9 @@ Makie.convert_arguments(::PointBased, ::MyConvVector) = ([Point(10, 20)],)
@test apply_conversion(CT, polygon) isa Tuple{Vector{Point2{T_out}}}
@test apply_conversion(CT, [polygon, polygon]) isa Tuple{Vector{Point2{T_out}}}
@test apply_conversion(CT, MultiPolygon([polygon, polygon])) isa Tuple{Vector{Point2{T_out}}}
@test apply_conversion(CT, polygon3d) isa Tuple{Vector{Point3{T_out}}}
@test apply_conversion(CT, [polygon3d, polygon3d]) isa Tuple{Vector{Point3{T_out}}}
@test apply_conversion(CT, MultiPolygon([polygon3d, polygon3d])) isa Tuple{Vector{Point3{T_out}}}
@test apply_conversion(CT, line) isa Tuple{Vector{Point3{T_out}}}
@test apply_conversion(CT, [line, line]) isa Tuple{Vector{Point3{T_out}}}
@test apply_conversion(CT, MultiLineString([line, line])) isa Tuple{Vector{Point3{T_out}}}
Expand Down
Loading