Why does construction using the type alias for Hyperplane result in an error?
using FastClosures, GLMakie, Random, Distributions, Parameters, Rotations, StaticArrays, LinearAlgebra, CoordinateTransformations, Makie, Meshes, Unitful
const VectorNd{N} = SVector{N,Float64}
const Vector2d = VectorNd{2}
const Vector3d = VectorNd{3}
homogenize(x::Union{SVector, Meshes.Vec}) = push(x,one(eltype(x)))
struct Hyperplane{N} <: StaticVector{N, Float64}
v::VectorNd{N}
Hyperplane(v::VectorNd{N}) where N = new{N}(v / norm(v[1:N-1]))
end
@inline Base.getindex(p::Hyperplane, i::Int) = getindex(p.v, i)
@inline Tuple(p::Hyperplane) = Tuple(p.v)
const Line2 = Hyperplane{3}
Line2(SVector{3}(1.,2.,4.))
results in
ERROR: DimensionMismatch: No precise constructor for Line2 found. Length of input was 3.
Stacktrace:
[1] _no_precise_size(SA::Type, x::Tuple{Float64, Float64, Float64})
@ StaticArrays ~/.julia/packages/StaticArrays/MSJcA/src/convert.jl:169
[2] construct_type(::Type{Line2}, x::StaticArrays.Args{Tuple{Tuple{Tuple{Float64, Float64, Float64}}}})
@ StaticArrays ~/.julia/packages/StaticArrays/MSJcA/src/convert.jl:89
[3] StaticArray (repeats 2 times)
@ ~/.julia/packages/StaticArrays/MSJcA/src/convert.jl:173 [inlined]
[4] Line2(sa::SVector{3, Float64})
@ StaticArrays ~/.julia/packages/StaticArrays/MSJcA/src/convert.jl:180
[5] top-level scope
@ REPL[11]:1
Clearly I am missing something about the type system. Thank you.