From 4ab88c17e63dab297924891621e83dc18b6d3f45 Mon Sep 17 00:00:00 2001 From: schillic Date: Thu, 25 Oct 2018 09:32:03 +0200 Subject: [PATCH] disambiguity --- src/is_intersection_empty.jl | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/src/is_intersection_empty.jl b/src/is_intersection_empty.jl index bafa625e051..b11c8b00fd7 100644 --- a/src/is_intersection_empty.jl +++ b/src/is_intersection_empty.jl @@ -849,7 +849,6 @@ Note that this method can be used with any set ``P`` whose constraints are known function is_intersection_empty(X::LazySet{N}, P::Union{HPolyhedron{N}, HPolytope{N}, AbstractHPolygon{N}} )::Bool where N<:Real - for Hi in constraints_list(P) if is_intersection_empty(X, Hi) return true @@ -858,13 +857,39 @@ function is_intersection_empty(X::LazySet{N}, return false end -# symmetric function +# symmetric method function is_intersection_empty(P::Union{HPolyhedron{N}, HPolytope{N}, AbstractHPolygon{N}}, X::LazySet{N} )::Bool where N<:Real return is_intersection_empty(X, P) end +# disambiguity +function is_intersection_empty(P::Union{HPolyhedron{N}, HPolytope{N}, AbstractHPolygon{N}}, + Q::Union{HPolyhedron{N}, HPolytope{N}, AbstractHPolygon{N}} + )::Bool where N<:Real + for Hi in constraints_list(P) + if is_intersection_empty(Q, Hi) + return true + end + end + return false +end + +# disambiguity +function is_intersection_empty(P::Union{HPolyhedron{N}, HPolytope{N}, AbstractHPolygon{N}}, + hs::HalfSpace{N} + )::Bool where N<:Real + return -ρ(-hs.a, P; kwargs...) > hs.b +end + +# symmetric method +function is_intersection_empty(hs::HalfSpace{N} + P::Union{HPolyhedron{N}, HPolytope{N}, AbstractHPolygon{N}}, + )::Bool where N<:Real + return is_intersection_empty(P, hs) +end + # --- alias ---