mirror of https://github.com/CGAL/cgal
solved conflict
This commit is contained in:
parent
b99ae574d1
commit
15e80b0a78
|
|
@ -1039,19 +1039,21 @@ bool polygon_soup_snap_rounding(PointRange &points,
|
||||||
* \cgalParamDefault{false}
|
* \cgalParamDefault{false}
|
||||||
* \cgalParamNEnd
|
* \cgalParamNEnd
|
||||||
* \cgalParamNBegin{snap_grid_size}
|
* \cgalParamNBegin{snap_grid_size}
|
||||||
* \cgalParamDescription{A value `gs` used to scale the points to `[-2^gs, 2^gs]` before rounding them on integers. Used only if `apply_iterative_snap_rounding()` is set to `true`.}
|
* \cgalParamDescription{A value `gs` used to scale the points to `[-2^gs, 2^gs]` before rounding them on integers. Used only if `apply_iterative_snap_rounding()` is set to `true`}
|
||||||
* \cgalParamType{unsigned int}
|
* \cgalParamType{unsigned int}
|
||||||
* \cgalParamDefault{23}
|
* \cgalParamDefault{23}
|
||||||
* \cgalParamExtra{Must be lower than 52.}
|
* \cgalParamExtra{Must be lower than 52.}
|
||||||
* \cgalParamNEnd
|
* \cgalParamNEnd
|
||||||
* \cgalParamNBegin{number_of_iterations}
|
* \cgalParamNBegin{number_of_iterations}
|
||||||
* \cgalParamDescription{Maximum number of iteration performed by the snap algorithm. Use only if `apply_iterative_snap_rounding` is true.}
|
* \cgalParamDescription{Maximum number of iterations performed by the snap algorithm. Used only if `apply_iterative_snap_rounding` is true.}
|
||||||
* \cgalParamType{unsigned int}
|
* \cgalParamType{unsigned int}
|
||||||
* \cgalParamDefault{15}
|
* \cgalParamDefault{15}
|
||||||
* \cgalParamNEnd
|
* \cgalParamNEnd
|
||||||
* \cgalNamedParamsEnd
|
* \cgalNamedParamsEnd
|
||||||
*
|
*
|
||||||
* \return `true` if the modified triangle soup is free from self-intersection, and `false` otherwise. The return value is only meaningful when the option `apply_snap_rounding()` is set to true.
|
* \return `true` if `apply_iterative_snap_rounding` is set to `false`; otherwise, return `true` if the modified triangle soup is free from
|
||||||
|
* self-intersection, and `false` if the algorithm was unable to provide such a triangle soup within the number of iterations.
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
template <class PointRange, class TriangleRange, class NamedParameters = parameters::Default_named_parameters>
|
template <class PointRange, class TriangleRange, class NamedParameters = parameters::Default_named_parameters>
|
||||||
bool autorefine_triangle_soup(PointRange& soup_points,
|
bool autorefine_triangle_soup(PointRange& soup_points,
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,6 @@
|
||||||
|
|
||||||
#include <CGAL/Fraction_traits.h>
|
#include <CGAL/Fraction_traits.h>
|
||||||
#include <CGAL/Lazy_exact_nt.h>
|
#include <CGAL/Lazy_exact_nt.h>
|
||||||
#include <CGAL/Gmpq.h>
|
|
||||||
|
|
||||||
namespace CGAL
|
namespace CGAL
|
||||||
{
|
{
|
||||||
|
|
@ -33,11 +32,11 @@ namespace Polygon_mesh_processing
|
||||||
namespace internal
|
namespace internal
|
||||||
{
|
{
|
||||||
|
|
||||||
template <class NT> double ceil(Lazy_exact_nt< NT > x);
|
template <class NT> double double_ceil(Lazy_exact_nt< NT > x);
|
||||||
template <class NT> double ceil(NT x);
|
template <class NT> double double_ceil(NT x);
|
||||||
|
|
||||||
template <class NT>
|
template <class NT>
|
||||||
double ceil(Lazy_exact_nt< NT > x){
|
double double_ceil(Lazy_exact_nt< NT > x){
|
||||||
// If both sides are in the same ceil, return this ceil
|
// If both sides are in the same ceil, return this ceil
|
||||||
double ceil_left=std::ceil(to_interval(x).first);
|
double ceil_left=std::ceil(to_interval(x).first);
|
||||||
if(ceil_left==std::ceil(to_interval(x).second))
|
if(ceil_left==std::ceil(to_interval(x).second))
|
||||||
|
|
@ -48,11 +47,11 @@ double ceil(Lazy_exact_nt< NT > x){
|
||||||
if(ceil_left==std::ceil(to_interval(x).second))
|
if(ceil_left==std::ceil(to_interval(x).second))
|
||||||
return ceil_left;
|
return ceil_left;
|
||||||
// If not return the ceil of the exact value
|
// If not return the ceil of the exact value
|
||||||
return ceil( x.exact());
|
return double_ceil( x.exact());
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class NT>
|
template <class NT>
|
||||||
double ceil(NT x){
|
double double_ceil(NT x){
|
||||||
using FT = Fraction_traits<NT>;
|
using FT = Fraction_traits<NT>;
|
||||||
if constexpr(std::is_same<typename FT::Is_fraction, Tag_true>::value){
|
if constexpr(std::is_same<typename FT::Is_fraction, Tag_true>::value){
|
||||||
// If NT is a fraction, the ceil value is the result of the euclidian division of the numerator and the denominator.
|
// If NT is a fraction, the ceil value is the result of the euclidian division of the numerator and the denominator.
|
||||||
|
|
@ -60,8 +59,8 @@ double ceil(NT x){
|
||||||
typename FT::Denominator_type denom;
|
typename FT::Denominator_type denom;
|
||||||
typename FT::Decompose()(x,num,denom);
|
typename FT::Decompose()(x,num,denom);
|
||||||
div_mod(num, denom, r, e);
|
div_mod(num, denom, r, e);
|
||||||
if((r<0) && e!=0) //If the result is negative, the ceil value is one below
|
if((r>=0) && e!=0) //If the result is positive, the ceil value is one above
|
||||||
return to_double(r-1);
|
return to_double(r+1);
|
||||||
return to_double(r);
|
return to_double(r);
|
||||||
} else {
|
} else {
|
||||||
// Return the ceil of the approximation
|
// Return the ceil of the approximation
|
||||||
|
|
@ -184,7 +183,7 @@ bool polygon_soup_snap_rounding(PointRange &points,
|
||||||
{
|
{
|
||||||
// Scale the coordinate, round to nearest integer and scale back
|
// Scale the coordinate, round to nearest integer and scale back
|
||||||
// TODO replace this ceil by the one of Algebraic_fondation when it will be add to master
|
// TODO replace this ceil by the one of Algebraic_fondation when it will be add to master
|
||||||
return internal::ceil((x * scale) - 0.5) / scale;
|
return internal::double_ceil((x * scale) - 0.5) / scale;
|
||||||
// return ceil((x * scale) - 0.5) / scale;
|
// return ceil((x * scale) - 0.5) / scale;
|
||||||
};
|
};
|
||||||
auto snap_p = [scale, snap](const Point_3 &p)
|
auto snap_p = [scale, snap](const Point_3 &p)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue