diff --git a/src/Zonotope.jl b/src/Zonotope.jl index 18067e11af..6c7d720f6b 100644 --- a/src/Zonotope.jl +++ b/src/Zonotope.jl @@ -386,21 +386,3 @@ function reduce_order(Z::Zonotope{N}, r)::Zonotope{N} where {N<:Real} end return Zonotope(c, Gred) end - -""" - convert(::Type{Zonotope}, H::AbstractHyperrectangle{N}) where {N} - -Converts a hyperrectangular set to a zonotope. - -### Input - -- `Zonotope` -- `H` -- hyperrectangular set - -### Output - -A zonotope. -""" -function convert(::Type{Zonotope}, H::AbstractHyperrectangle{N}) where {N} - return Zonotope{N}(center(H), diagm(radius_hyperrectangle(H))) -end diff --git a/src/convert.jl b/src/convert.jl index 0b21d92f85..c810829e4c 100644 --- a/src/convert.jl +++ b/src/convert.jl @@ -60,3 +60,21 @@ function convert(::Type{HPOLYGON}, end return HPOLYGON(P.constraints) end + +""" + convert(::Type{Zonotope}, H::AbstractHyperrectangle{N}) where {N} + +Converts a hyperrectangular set to a zonotope. + +### Input + +- `Zonotope` +- `H` -- hyperrectangular set + +### Output + +A zonotope. +""" +function convert(::Type{Zonotope}, H::AbstractHyperrectangle{N}) where {N} + return Zonotope{N}(center(H), diagm(radius_hyperrectangle(H))) +end