[PPL-devel] easy way to extract rays from a polyhedron

Roberto Bagnara bagnara at cs.unipr.it
Sun Jan 15 10:15:26 CET 2017


On 01/14/2017 05:18 PM, John Perry wrote:
> I'd like to extract the rays of a polyhedron. As far as I can tell from the documentation, the only way to do this is to extract the generators, then loop over them, testing which is a ray:
> 
>     Generator_System G = P.generators();
>     for (Generator g : G)
>         if (g.is_ray()) {
>             /* party time */
>         }
> 
> Is there a more direct way to do this, something like G.rays() or even P.rays()?

Hello John,

the snippet above makes lots of unnecessary copies.
I would do something like

  const Generator_System& G = P.generators();
  for (const Generator& g : G)
    if (g.is_ray()) {
      /* party time */
    }

At party time you can copy `g' if you need to
modify the selected ray.

Apart from this, no, there is no more direct way:
if it were, it would be implemented along those lines.
Kind regards,

   Roberto

-- 
     Prof. Roberto Bagnara

Applied Formal Methods Laboratory - University of Parma, Italy
mailto:bagnara at cs.unipr.it
                              BUGSENG srl - http://bugseng.com
                              mailto:roberto.bagnara at bugseng.com



More information about the PPL-devel mailing list