From d5910966af7fc76693472c79b0e452424933d7d9 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Wed, 9 Aug 2006 16:18:32 +0200 Subject: [PATCH] reduce_domain: compute convex union of domain The domain should be a convex polyhedron, but in some rare cases, Polyhedron2Param_SimplifiedDomain may return it as a union of smaller pieces. Taking the convex union thus has no effect other than making sure we don't forget about the other parts in the union. --- reduce_domain.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/reduce_domain.c b/reduce_domain.c index 16251c8..f5952c1 100644 --- a/reduce_domain.c +++ b/reduce_domain.c @@ -4,10 +4,12 @@ Polyhedron *reduce_domain(Polyhedron *D, Matrix *CT, Polyhedron *CEq, Polyhedron **fVD, int nd, unsigned MaxRays) { Polyhedron *Dt, *rVD; + Polyhedron *C; Value c; int i; - Dt = CT ? DomainPreimage(D, CT, MaxRays) : D; + C = D->next ? DomainConvex(D, MaxRays) : D; + Dt = CT ? DomainPreimage(C, CT, MaxRays) : C; rVD = CEq ? DomainIntersection(Dt, CEq, MaxRays) : Domain_Copy(Dt); /* if rVD is empty or too small in geometric dimension */ @@ -15,11 +17,15 @@ Polyhedron *reduce_domain(Polyhedron *D, Matrix *CT, Polyhedron *CEq, (CEq && rVD->Dimension-rVD->NbEq < Dt->Dimension-Dt->NbEq-CEq->NbEq)) { if(rVD) Domain_Free(rVD); + if (D->next) + Polyhedron_Free(C); if (CT) Domain_Free(Dt); return 0; /* empty validity domain */ } + if (D->next) + Polyhedron_Free(C); if (CT) Domain_Free(Dt); -- 2.11.4.GIT