Skip to content

Commit

Permalink
Merge pull request #3688 from JuliaReach/schillic/vpolygon
Browse files Browse the repository at this point in the history
Make `tohrep` of `VPolgyon` type stable
  • Loading branch information
schillic authored Dec 21, 2024
2 parents 2b4a027 + 85baef0 commit a0dd151
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/Sets/VPolygon/VPolygonModule.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ using Reexport, Requires

using ..LazySets: AbstractPolygon, LazySet, AbstractHPolygon, halfspace_left,
is_right_turn, _area_vlist, _extrema_vlist, _high_vlist,
_intersection_vrep_2d, _linear_map_vrep, _low_vlist,
_minkowski_sum_vrep_2d, _to_colVector
_infeasible_constraints_list, _intersection_vrep_2d,
_linear_map_vrep, _low_vlist, _minkowski_sum_vrep_2d,
_to_colVector
using ..HPolygonModule: HPolygon
using LinearAlgebra: dot
using Random: AbstractRNG, GLOBAL_RNG, shuffle
Expand Down
2 changes: 1 addition & 1 deletion src/Sets/VPolygon/tohrep.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function tohrep(P::VPolygon{N}, ::Type{HPOLYGON}=HPolygon) where {N,HPOLYGON<:Ab
n = length(vl)
if n == 0
# no vertex
return EmptySet{N}(2)
constraints_list = _infeasible_constraints_list(2; N=N)
elseif n == 1
# only one vertex -> use function for singletons
require(@__MODULE__, :LazySets; fun_name="convert")
Expand Down
3 changes: 2 additions & 1 deletion test/Sets/Polygon.jl
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,8 @@ for N in [Float64, Float32, Rational{Int}]
end

# empty VPolygon: conversion to hrep
@test tohrep(VPolygon{N}()) isa EmptySet{N}
P = tohrep(VPolygon{N}())
@test P isa HPolygon{N} && isempty(P)

# test VPolygon constructor given the matrix of vertices
m = N[4 0; 6 2; 4 4]'
Expand Down

0 comments on commit a0dd151

Please sign in to comment.