JuliaGraphics / Luxor.jl

Simple drawings using vector graphics; Cairo "for tourists!"

Home Page:http://juliagraphics.github.io/Luxor.jl/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add support for `zero(Point)`

hyrodium opened this issue · comments

I thought it would be nice to have a method zero(Point) to get Point(0.0, 0.0).

julia> using Luxor

julia> zero(Point)
ERROR: MethodError: no method matching zero(::Type{Point})
Closest candidates are:
  zero(::Union{Type{P}, P}) where P<:Dates.Period at ~/julia/julia-1.7.2/share/julia/stdlib/v1.7/Dates/src/periods.jl:53
  zero(::AbstractIrrational) at ~/julia/julia-1.7.2/share/julia/base/irrationals.jl:150
  zero(::T) where T<:Dates.TimeType at ~/julia/julia-1.7.2/share/julia/stdlib/v1.7/Dates/src/types.jl:450
  ...
Stacktrace:
 [1] top-level scope
   @ REPL[2]:1

Would this change be desirable? If so, I'll make a PR.

I haven't yet felt the need for it (I use O whenever I need Point(0, 0), but if you think it would be a valuable and non-disruptive addition, go for it...!