hermann on Tue, 16 Jul 2024 00:06:25 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: vector of t_FRAC questions


On 2024-07-15 23:11, Bill Allombert wrote:
You are not supposed to use mkfrac with a denominator of 1,
since you already have a t_INT.

Instead you can use

GEN
mkfrac_or_int(GEN a, GEN b)
{
  return equali1(b) ? a: mkfrac(a,b);
}

Cheers,
Bill

Thanks, committed inclusive link to your posting:
https://github.com/Hermann-SW/cgal4gp/commit/a1421bb497faf0bbec88c1ac7fb46f4e8b4cac79

mkfrac_or_int does its job well:

? get_all_build_directions(dir)
? dir
[[81920, 917504, -40960], [204800, 2293760, -102400], [122880, 1376256, -61440], [81920, 917504, -40960], [-122880, -1376256, 61440], [-40960, -458752, 20480], [-163840, -1835008, 81920], [-163840, -1835008, 81920]]
?


With simplification "[d/gcd(d) | d<-dir]" it can be seen easily that only two different build directions are reported:

? [d/gcd(d) | d<-dir]
[[10, 112, -5], [10, 112, -5], [10, 112, -5], [10, 112, -5], [-10, -112, 5], [-10, -112, 5], [-10, -112, 5], [-10, -112, 5]]
?

I created new issue against CGAL on this:
https://github.com/CGAL/cgal/issues/8358


Regards,

Hermann.