CGAL / cgal

The public CGAL repository, see the README below
https://github.com/CGAL/cgal#readme
Other
4.66k stars 1.35k forks source link

Mesh_2 criteria should accept an angle #8262

Open sloriot opened 3 weeks ago

sloriot commented 3 weeks ago

https://doc.cgal.org/latest/Mesh_2/classCGAL_1_1Delaunay__mesh__size__criteria__2.html

b parameter is sin(alpha)^2 which is not obvious. At least it should be documented like that and even better an overload with directly the minimal angle should be provided

lrineau commented 3 weeks ago

An overload with named parameters would be nice. And given that, we could add the angle parameter as a real angle (in degrees?).

afabri commented 3 weeks ago

And using Boost.Units?

lrineau commented 3 weeks ago

And using Boost.Units?

Boost Units is 20 years old, and the latest improvement, according to the release notes as of now, was 14 years ago. So no.

If we were to use a C++ units library, my choice would be without a doubt @mpusz's mp-units library. Its author Mateusz Pusz is leading the work to introduce units support in C++. See https://github.com/cplusplus/papers/issues/1655 and https://github.com/cplusplus/papers/issues/1752 to follow the progression of that work. His library mp-units is almost certainly like what range-v3 is to C++20 ranges, and was, even years before the standardization.

afabri commented 3 weeks ago

So how do you imagine the overload of the constructor with yet another double ?

lrineau commented 3 weeks ago

So how do you imagine the overload of the constructor with yet another double ?

That is why I said named parameters. The overload with named parameters can only take named parameters, and will "replace" the existing parameters with named one, and add the parameter "lower bound on angles, in degree".

mpusz commented 3 weeks ago

If you need any help getting started, please don't hesitate to let me know. I believe that not only strong units and quantities but also the affine space abstraction can be very useful in your project.

lrineau commented 3 weeks ago

If you need any help getting started, please don't hesitate to let me know. I believe that not only strong units and quantities but also the affine space abstraction can be very useful in your project.

Thanks Mateusz (@mpusz). For now, the CGAL libraries have to be compatible with various C++ versions, starting from C++17. As mp-units requires C++20, a support for mp-units in CGAL would have to use macros, to disable that support for users requiring C++17. Do you know any C++ project using mp-units that way, conditionally with macros?

mpusz commented 3 weeks ago

I am not aware of such a project.

However, if I understand correctly, you already use fundamental unsafe types in your interfaces. If so, you can easily conditionally add additional type-safe overloads to them.

In case you already have some Simple strong-type wrappers for units, mp-units provides powerful conversation traits that give us full control of how we can interact with such interfaces.

lrineau commented 3 weeks ago

I am not aware of such a project.

However, if I understand correctly, you already use fundamental unsafe types in your interfaces. If so, you can easily conditionally add additional type-safe overloads to them.

In case you already have some Simple strong-type wrappers for units, mp-units provides powerful conversation traits that give us full control of how we can interact with such interfaces.

Thanks @mpusz. Indeed, there is a chance that we could support mp-units types in addition to the support of our unsafe types (like double or types from gmpxx). I have created a new issue about that topic: https://github.com/CGAL/cgal/issues/8270

chiphogg commented 4 days ago

There is also a high-quality production-level units library that is compatible as far back as C++14: Au (aurora-opensource/au). We've been closely collaborating with the mp-units project for several years, sharing ideas (and occasionally code) back and forth, and also collaborating on the Standard Units Library proposal. You can see how it compares on our comparison of alternatives page, which also includes other popular libraries such as boost units, nholthaus, and bernedom/SI.

If you want a modern units library that supports C++17, I think Au is your best bet. I'm definitely biased, because --- full disclosure --- I'm the primary author. :slightly_smiling_face: But I also think this conclusion is easy to support by objectively comparing the various C++17-compatible options.

Feel free to check it out!