I have a simple composite type I use to keep track of a 3D vector that looks like this.
abstract type AbstractVec{T<:Number} end
" xyzVecT is the object definition to contain the cartesian information "
struct xyzVecT{T} <:AbstractVec{T}
x::T
y::T
z::T
end
It was one of the first custom types I made learning Julia, so I’ve gradually been trying to make it work with the more advanced packages like diffeqs and makie, etc. I thought I had it working with Makie, until I tried to Makie it also work with Symbolics and I think I’ve broken something. At the same time I started breaking things out into Package extensions, but that shouldn’t matter for this case.
So my first thought is, there is probably instruction out there that kind of tells how to do this generically, but I haven’t found it and the piece of Makie that I’m getting stuck on is convert_single_argument as there are very few words and no examples written about it in the Recipes manual for Makie.
I had tried to “overload” the Point3 function in geometry basics because I had done some things incorrectly and this is called by my convert_single_argument.
GeometryBasics.Point3(v::xyzVecT{T}) where {T<:AbstractFloat} = GeometryBasics.Point3{T}(v.x, v.y, v.z)
MakieCore.convert_single_argument(v::xyzVecT{T}) where T<:AbstractFloat = GeometryBasics.Point3{T}(v)
One thing that isn’t clear is, do I really need a version of convert_single_argument that takes a vector and not a single point or do I define the single point and it automatically can handle a vector version of it. I’m thinking I need to make it recognize a Vector case.
But I think in general I need to figure out why this doesn’t work.
x1=xyzVecT(1.0,2.0,3.0)
@show decompose(Point3f,x1)
MethodError: no method matching coordinates(::xyzVector.xyzVecT{Float64})
Any good guides on how to build up custom composite types to work correctly with all of these tools. I’m not quite getting it from the “recipes” tutorial in Makie.
Thanks again for the noob questions.
Allan