easy way to extract rays from a polyhedron
Hello 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()? thank you john perry — John Perry + john.perry@usm.edu Associate Professor, Department of Mathematics University of Southern Mississippi, Box 5045 Hattiesburg MS 39406 You can and you can’t; you will and you won’t; you’re damned if you do; you’re damned if you don’t. — Lorenzo Dow anticipates C++ compilers by 200 years
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@cs.unipr.it BUGSENG srl - http://bugseng.com mailto:roberto.bagnara@bugseng.com
On Jan 15, 2017, at 3:15 AM, Roberto Bagnara <bagnara@cs.unipr.it> wrote:
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 */ }
Oh, right, thank you! I actually had the second, but not the first.
Apart from this, no, there is no more direct way: if it were, it would be implemented along those lines.
I understand. Thank you again. sincerely regards john perry
participants (2)
-
John Perry -
Roberto Bagnara