diff --git a/src/storm/storage/geometry/NativePolytope.cpp b/src/storm/storage/geometry/NativePolytope.cpp index 9f1dc4174..886f01b91 100644 --- a/src/storm/storage/geometry/NativePolytope.cpp +++ b/src/storm/storage/geometry/NativePolytope.cpp @@ -190,14 +190,20 @@ namespace storm { template std::shared_ptr> NativePolytope::intersection(std::shared_ptr> const& rhs) const{ STORM_LOG_THROW(rhs->isNativePolytope(), storm::exceptions::InvalidArgumentException, "Invoked operation between a NativePolytope and a different polytope implementation. This is not supported"); - NativePolytope const& nativeRhs = dynamic_cast const&>(*rhs); - EigenMatrix resultA(A.rows() + nativeRhs.A.rows(), A.cols()); - resultA << A, - nativeRhs.A; - EigenVector resultb(resultA.rows()); - resultb << b, - nativeRhs.b; - return std::make_shared>(EmptyStatus::Unknown, std::move(resultA), std::move(resultb)); + if (this->isUniversal()) { + return rhs; + } else if (rhs->isUniversal()) { + return std::make_shared>(*this); + } else { + NativePolytope const& nativeRhs = dynamic_cast const&>(*rhs); + EigenMatrix resultA(A.rows() + nativeRhs.A.rows(), A.cols()); + resultA << A, + nativeRhs.A; + EigenVector resultb(resultA.rows()); + resultb << b, + nativeRhs.b; + return std::make_shared>(EmptyStatus::Unknown, std::move(resultA), std::move(resultb)); + } } template