JuliaGraphics / Luxor.jl

Simple drawings using vector graphics; Cairo "for tourists!"
http://juliagraphics.github.io/Luxor.jl/
Other
588 stars 71 forks source link

Add methods to `Base.zero` #223

Closed hyrodium closed 2 years ago

hyrodium commented 2 years ago

This PR fixes #221.

julia> using Luxor

julia> zero(Point)
Point(0.0, 0.0)

julia> zero(Point(1,2))
Point(0.0, 0.0)

julia> zeros(Point, 4)
4-element Vector{Point}:
 Point(0.0, 0.0)
 Point(0.0, 0.0)
 Point(0.0, 0.0)
 Point(0.0, 0.0)

julia> iszero(O)
true

julia> iszero(Point(1,2))
false