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

ElasticArrays input broken for arrows #4708

Open
chakravala opened this issue Jan 7, 2025 · 2 comments
Open

ElasticArrays input broken for arrows #4708

chakravala opened this issue Jan 7, 2025 · 2 comments
Labels
arrows Regarding the arrows plot type bug conversions Mainly `convert_arguments` good first issue This should come with some instructions! Makie Backend independent issues (Makie core)

Comments

@chakravala
Copy link

Makie v0.21.18

using ElasticArrays
arrows(ElasticArray(zeros(Point{3},10)),ElasticArray(zeros(Point{3},10)))
ERROR: MethodError: Cannot `convert` an object of type 
  ElasticVector{Vec{3, Float32}, Vector{Vec{3, Float32}}} to an object of type 
  Union{Vec3f, Vector{Vec{3, Float32}}, GeometryBasics.Vecf{3}, Vec3{Float32}}
@chakravala chakravala added the bug label Jan 7, 2025
@chakravala
Copy link
Author

one possible fix to this is to simply call vec on the inputs

@ffreyer ffreyer added Makie Backend independent issues (Makie core) conversions Mainly `convert_arguments` arrows Regarding the arrows plot type good first issue This should come with some instructions! labels Jan 18, 2025
@ffreyer
Copy link
Collaborator

ffreyer commented Jan 18, 2025

Should be easy to fix by adjusting these methods:

function convert_arguments(::Type{<: Arrows}, x, y, u, v)
return (Point2{float_type(x, y)}.(x, y), Vec2{float_type(u, v)}.(u, v))
end
function convert_arguments(::Type{<: Arrows}, x::AbstractVector, y::AbstractVector, u::AbstractMatrix, v::AbstractMatrix)
return (vec(Point2{float_type(x, y)}.(x, y')), vec(Vec2{float_type(u, v)}.(u, v)))
end
function convert_arguments(::Type{<: Arrows}, x, y, z, u, v, w)
return (Point3{float_type(x, y, z)}.(x, y, z), Vec3{float_type(u, v, w)}.(u, v, w))
end

These can probably rely on convert_arguments(PointBased(), x, y[, z]) to avoid duplicating code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arrows Regarding the arrows plot type bug conversions Mainly `convert_arguments` good first issue This should come with some instructions! Makie Backend independent issues (Makie core)
Projects
None yet
Development

No branches or pull requests

2 participants