Add the functor Non_zero_dimension_3 to the Kernel

This commit is contained in:
Andreas Fabri 2021-03-23 15:45:54 +01:00
parent 6a2be4d710
commit e98198178f
3 changed files with 41 additions and 3 deletions

View File

@ -37,6 +37,41 @@ namespace CGAL {
namespace CommonKernelFunctors {
template <typename K>
class Non_zero_dimension_3
{
typedef typename K::Vector_3 Vector_3;
public:
typedef int result_type;
int operator()(const Vector_3& vec) const
{
int dir = -1;
if(certainly_not(is_zero(vec.x()))){
dir = 0;
} else if(certainly_not(is_zero(vec.y()))){
dir = 1;
}else if(certainly_not(is_zero(vec.y()))){
dir = 2;
}
if(dir == -1){
if(! is_zero(vec.x())){
return 0;
} else if(! is_zero(vec.y())){
return 1;
} else if(! is_zero(vec.z())){
return 2;
}
}
return dir;
}
};
template <typename K>
class Are_ordered_along_line_2
{

View File

@ -582,6 +582,8 @@ CGAL_Kernel_pred(Less_y_3,
less_y_3_object)
CGAL_Kernel_pred(Less_z_3,
less_z_3_object)
CGAL_Kernel_pred(Non_zero_dimension_3,
non_zero_dimension_3_object)
CGAL_Kernel_pred_RT(Orientation_2,
orientation_2_object)
CGAL_Kernel_pred_RT(Orientation_3,

View File

@ -99,8 +99,9 @@ Bounded_side bounded_side_3(IteratorForward first,
we don't need to care about the plane orientation */
}
typename R::Non_zero_dimension_3 non_zero_dimension_3;
int dir = non_zero_dimension_3(plane.orthogonal_vector());
#if 0
auto apv = approx(plane.orthogonal_vector());
int dir = 0;
@ -112,7 +113,7 @@ Bounded_side bounded_side_3(IteratorForward first,
if(CGAL::abs(apv.z().sup()) > max){
dir = 2;
}
#endif
CGAL_assertion(!plane.is_degenerate());
Point_2 (*t)(const Point_3&);