[PPL-devel] newbie question - point containment within polyhedron

Roberto Bagnara bagnara at cs.unipr.it
Sun Jan 28 19:21:33 CET 2007


Manoj Rajagopalan wrote:
> Hi all
> 
>    How do I check if a point is contained within a polyhedron?

Dear Manoj,

a point is just one kind of polyhedra generator.  To compute the
relation between a polyhedron and a generator, you do something
like

     Poly_Gen_Relation rel = ph.relation_with(g),

assuming `ph' is the polyhedron and `g' is the point you are
interested in.  If `rel' so computed turns out to be equal to

     Poly_Gen_Relation::subsumes(),

then you know `ph' subsumes `g', i.e., that adding the generator `g'
to `ph' would not change `ph', i.e., that `ph' already contains `g'.

> Firstly, 
> how do i represent the point? in terms of X, Y, Z where these are 
> declared to be of type Variable?

You can do something like

     Generator g = point(X + 2*Y - 3*Z).

>    Would someone have any example code snippets to illustrate related 
> points?

You can find more examples in the library's documentation and  in the
`tests' directory of the PPL distribution.

> thanks
> Manoj Rajagopalan

All the best,

     Roberto

-- 
Prof. Roberto Bagnara
Computer Science Group
Department of Mathematics, University of Parma, Italy
http://www.cs.unipr.it/~bagnara/
mailto:bagnara at cs.unipr.it



More information about the PPL-devel mailing list