Skip to content

Commit

Permalink
WIP BACKUP
Browse files Browse the repository at this point in the history
  • Loading branch information
sloriot committed Jun 28, 2023
1 parent f65aa68 commit 86a13fa
Show file tree
Hide file tree
Showing 32 changed files with 706 additions and 718 deletions.
3 changes: 3 additions & 0 deletions AABB_tree/test/AABB_tree/AABB_test_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ void test_all_intersection_query_types(Tree& tree)
std::optional< typename Tree::AABB_traits::template Intersection_and_primitive_id<Ray>::Type > r = tree.any_intersection(ray);
std::optional< typename Tree::AABB_traits::template Intersection_and_primitive_id<Line>::Type > l = tree.any_intersection(line);
std::optional< typename Tree::AABB_traits::template Intersection_and_primitive_id<Segment>::Type > s = tree.any_intersection(segment);
CGAL_USE(r);
CGAL_USE(l);
CGAL_USE(s);

// any_intersected_primitive
std::optional<typename Primitive::Id> optional_primitive;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ class Algebraic_curve_kernel_2 : public AlgebraicKernel_d_1{
result_type operator() (const argument_type& arg) const {
CGAL_assertion(bool(_inner));
CGAL_assertion(bool(_outer));
return _outer.get()(_inner.get()(arg));
return _outer.value()(_inner.value()(arg));
}
private:
::std::optional<InnerFunctor> _inner;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ class Algebraic_real_quadratic_refinement_rep_bfi
low_bfi_ = CGAL::convert_to_bfi(this->low());

high_bfi_ = CGAL::convert_to_bfi(this->high());
f_low_bfi_ = f_bfi_.get().evaluate(low_bfi_.get());
f_high_bfi_ = f_bfi_.get().evaluate(high_bfi_.get());
f_low_bfi_ = f_bfi_.value().evaluate(low_bfi_.value());
f_high_bfi_ = f_bfi_.value().evaluate(high_bfi_.value());

}

Expand All @@ -125,7 +125,7 @@ class Algebraic_real_quadratic_refinement_rep_bfi
}

m_bfi = CGAL::convert_to_bfi(m);
f_m_bfi = f_bfi_.get().evaluate(m_bfi);
f_m_bfi = f_bfi_.value().evaluate(m_bfi);

if(CGAL::zero_in(f_m_bfi)) {

Expand Down Expand Up @@ -329,25 +329,25 @@ class Algebraic_real_quadratic_refinement_rep_bfi
low_bfi_ = CGAL::convert_to_bfi(this->low());
}
if(! f_low_bfi_) {
f_low_bfi_ = f_bfi_.get().evaluate(low_bfi_.get());
f_low_bfi_ = f_bfi_.value().evaluate(low_bfi_.value());
}
if(! high_bfi_) {
high_bfi_ = CGAL::convert_to_bfi(this->high());
}
if(! f_high_bfi_) {
f_high_bfi_ = f_bfi_.get().evaluate(high_bfi_.get());
f_high_bfi_ = f_bfi_.value().evaluate(high_bfi_.value());
}
Integer i;
while(true) {

if(CGAL::zero_in(f_low_bfi_.get() - f_high_bfi_.get())) {
if(CGAL::zero_in(f_low_bfi_.value() - f_high_bfi_.value())) {
_set_prec(2*prec_);
continue;
}

BFI denom = f_low_bfi_.get()-f_high_bfi_.get();
BFI denom = f_low_bfi_.value()-f_high_bfi_.value();

BFI z = f_low_bfi_.get() / denom;
BFI z = f_low_bfi_.value() / denom;

std::pair<Integer, Integer> int_pair = _to_integer_interval(z,N);
Integer i_low = int_pair.first;
Expand Down Expand Up @@ -458,7 +458,7 @@ class Algebraic_real_quadratic_refinement_rep_bfi
f_bfi_ = _convert_polynomial_to_bfi(this->polynomial());
}

BFI eval = f_bfi_.get().evaluate(convert_to_bfi(m));
BFI eval = f_bfi_.value().evaluate(convert_to_bfi(m));

CGAL::Sign s = CGAL::sign(CGAL::lower(eval));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,14 +181,14 @@ class Arr_circular_arc_traits_2 {
typedef std::variant<Point_2, X_monotone_curve_2>
Make_x_monotone_result;

std::vector<CGAL::Object> objs;
std::vector<Make_x_monotone_result> objs;
CircularKernel().make_x_monotone_2_object()(arc, std::back_inserter(objs));
for (const auto& obj : objs) {
if (const auto* p = CGAL::object_cast<Point_2>(&obj)) {
if (const auto* p = std::get_if<Point_2>(&obj)) {
*oi++ = Make_x_monotone_result(*p);
continue;
}
if (const auto* xcv = CGAL::object_cast<X_monotone_curve_2>(&obj)) {
if (const auto* xcv = std::get_if<X_monotone_curve_2>(&obj)) {
*oi++ = Make_x_monotone_result(*xcv);
continue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,19 +251,13 @@ namespace CGAL {
OutputIterator res) const
{
if ( const Arc1* arc1 = std::get_if<Arc1>( &A ) ) {
std::vector<CGAL::Object> container;
CircularKernel().
make_x_monotone_2_object()(*arc1,std::back_inserter(container));
return object_to_object_variant<CircularKernel, Arc1, Arc2>
(container, res);
return CircularKernel().
make_x_monotone_2_object()(*arc1, res);
}
else {
const Arc2* arc2 = std::get_if<Arc2>( &A );
std::vector<CGAL::Object> container;
CircularKernel().
make_x_monotone_2_object()(*arc2,std::back_inserter(container));
return object_to_object_variant<CircularKernel, Arc1, Arc2>
(container, res);
return CircularKernel().
make_x_monotone_2_object()(*arc2, res);
}
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,6 @@ class Arr_non_caching_segment_traits_2 :
OutputIterator oi) const
{
typedef std::pair<Point_2, Multiplicity> Intersection_point;
typedef std::variant<Intersection_point, X_monotone_curve_2>
Intersection_result;

const Kernel& kernel = m_traits;
auto res = kernel.intersect_2_object()(cv1, cv2);
Expand All @@ -241,7 +239,7 @@ class Arr_non_caching_segment_traits_2 :
// If the two segments intersect at their endpoints, then the
// multiplicity is undefined, but we deliberately ignore it for
// efficiency reasons.
*oi++ = Intersection_result(Intersection_point(*p_p, 1));
*oi++ = Intersection_point(*p_p, 1);
return oi;
}

Expand All @@ -257,11 +255,11 @@ class Arr_non_caching_segment_traits_2 :
// in the overlap segment
if (m_traits.compare_endpoints_xy_2_object()(*cv_p) != cmp1) {
auto ctr_opposite = kernel.construct_opposite_segment_2_object();
*oi++ = Intersection_result(ctr_opposite(*cv_p));
*oi++ = ctr_opposite(*cv_p);
return oi;
}
}
*oi++ = Intersection_result(*cv_p);
*oi++ = *cv_p;
return oi;
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ _get_unbounded_face(const Td_map_item& item,const Point_2& p,
Td_map_item& left_v_item = td.locate(tr.left(),td_lt);
CGAL_assertion(td_lt == TD::POINT);
Halfedge_const_handle he;
if (std::get<Td_active_vertex>(&left_v_item) != nullptr) {
if (std::get_if<Td_active_vertex>(&left_v_item) != nullptr) {
Td_active_vertex v(std::get<Td_active_vertex>(left_v_item));
he = v.cw_he();
}
Expand Down Expand Up @@ -216,7 +216,7 @@ _get_unbounded_face(const Td_map_item& item,const Point_2& p,
Td_map_item& right_v_item = td.locate(tr.right(),td_lt);
CGAL_assertion(td_lt == TD::POINT);
Halfedge_const_handle he;
if (std::get<Td_active_vertex>(&right_v_item)!= nullptr) {
if (std::get_if<Td_active_vertex>(&right_v_item)!= nullptr) {
Td_active_vertex v(std::get<Td_active_vertex>(right_v_item));
he = v.cw_he();
}
Expand Down
28 changes: 12 additions & 16 deletions Arrangement_on_surface_2/include/CGAL/Arr_polycurve_traits_2.h
Original file line number Diff line number Diff line change
Expand Up @@ -698,8 +698,7 @@ class Arr_polycurve_traits_2 :
typedef std::pair<Point_2, Multiplicity> Intersection_point;
typedef std::variant<Intersection_point, X_monotone_subcurve_2>
Intersection_base_result;
typedef std::variant<Intersection_point, X_monotone_curve_2>
Intersection_result;


const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2();
auto cmp_y_at_x = m_poly_traits.compare_y_at_x_2_object();
Expand Down Expand Up @@ -744,7 +743,7 @@ class Arr_polycurve_traits_2 :
// cv1's right endpoint equals cv2's left endpoint
// Thus we can return this single(!) intersection point
Intersection_point p(max_vertex(cv1[i1]), 0);
*oi++ = Intersection_result(p);
*oi++ = p;
return oi;
}
dir1 == SMALLER ?
Expand All @@ -767,7 +766,7 @@ class Arr_polycurve_traits_2 :
// cv2's right endpoint equals cv1's left endpoint
// Thus we can return this single(!) intersection point
Intersection_point p(max_vertex(cv2[i2]), 0);
*oi++ = Intersection_result(p);
*oi++ = p;
return oi;
}

Expand Down Expand Up @@ -833,7 +832,7 @@ class Arr_polycurve_traits_2 :

const Intersection_point* p_p =
std::get_if<Intersection_point>(&xection);
if (p_p != nullptr) *oi++ = Intersection_result(*p_p);
if (p_p != nullptr) *oi++ = *p_p;
}
}
else if (right_coincides && left_coincides) {
Expand Down Expand Up @@ -871,7 +870,7 @@ class Arr_polycurve_traits_2 :
// will be taken care of as the min_vertex of in the next
// iteration.
if (! equal(p_ptr->first, max_vertex(cv1[i1])))
*oi++ = Intersection_result(*p_ptr);
*oi++ = *p_ptr;
}
}
}
Expand All @@ -896,11 +895,11 @@ class Arr_polycurve_traits_2 :
// it multiplicity 0.
if (left_res == SMALLER) {
Intersection_point p(min_vertex(cv2[i2]), 0);
*oi++ = Intersection_result(p);
*oi++ = p;
}
else {
Intersection_point p(min_vertex(cv1[i1]), 0);
*oi++ = Intersection_result(p);
*oi++ = p;
}
}
}
Expand Down Expand Up @@ -941,15 +940,15 @@ class Arr_polycurve_traits_2 :
(i1 != Polycurve_traits_2::INVALID_INDEX) ?
return_point(max_vertex(cv1[i1+1]), 0) :
return_point(max_vertex(cv1[0]), 0);
*oi++ = Intersection_result(ip);
*oi++ = ip;
}
else if (right_res == LARGER) {
ip = (dir2 == SMALLER) ?
return_point(max_vertex(cv2[i2-1]), 0) :
(i2 != Polycurve_traits_2::INVALID_INDEX) ?
return_point(max_vertex(cv2[i2+1]), 0) :
return_point(max_vertex(cv2[0]), 0);
*oi++ = Intersection_result(ip);
*oi++ = ip;
}
else if (((i1 > 0) && (dir1 == SMALLER)) ||
((i1 < n1) && (dir1 != SMALLER)) ||
Expand All @@ -961,7 +960,7 @@ class Arr_polycurve_traits_2 :
(i1 != Polycurve_traits_2::INVALID_INDEX) ?
return_point(max_vertex(cv1[i1+1]), 0) :
return_point(max_vertex(cv1[0]), 0);
*oi++ = Intersection_result(ip);
*oi++ = ip;
}
else {
CGAL_assertion_msg((dir2 == SMALLER && i2 > 0) ||
Expand All @@ -976,7 +975,7 @@ class Arr_polycurve_traits_2 :
(i2 != Polycurve_traits_2::INVALID_INDEX) ?
return_point(max_vertex(cv2[i2+1]), 0) :
return_point(max_vertex(cv2[0]), 0);
*oi++ = Intersection_result(ip);
*oi++ = ip;
}
}

Expand All @@ -989,15 +988,12 @@ class Arr_polycurve_traits_2 :
inline OutputIterator output_ocv
(std::vector<X_monotone_subcurve_2>& ocv, bool invert_ocv, OutputIterator oi) const
{
typedef std::pair<Point_2, Multiplicity> Intersection_point;
typedef std::variant<Intersection_point, X_monotone_curve_2>
Intersection_result;
X_monotone_curve_2 curve;
if (invert_ocv)
std::reverse (ocv.begin(), ocv.end());
for (X_monotone_subcurve_2& sc : ocv)
curve.push_back (sc);
*(oi ++) = Intersection_result(curve);
*(oi ++) = curve;

ocv.clear();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2038,8 +2038,6 @@ class Continuous_rational_arc_d_1:
OutputIterator intersect(const Self& arc, OutputIterator oi,
const Cache& cache) const
{
typedef std::variant<Intersection_point, Self> Intersection_result;

CGAL_precondition(this->is_valid());
CGAL_precondition(this->is_continuous());
CGAL_precondition(arc.is_valid());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3580,7 +3580,7 @@ class Arr_traits_adaptor_2 :
// Verify the first intersection is an overlap, remove it, and
// recursively call.
const X_monotone_curve_2* xcv =
std::get<X_monotone_curve_2>(&(intersections.front()));
std::get_if<X_monotone_curve_2>(&(intersections.front()));
if (! xcv) {
CGAL_error_msg("The first intersection is not an overlap!");
return SMALLER;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -700,16 +700,15 @@ class Point_2 :
default:
// ASCII
os << "Point_2(";

os << this->ptr()->_m_xy;
os << oformat(this->ptr()->_m_xy);
os << ",";
os << this->ptr()->_m_x;
//~ os << this->ptr()->_m_x;
os << ",";
os << this->ptr()->_m_curve;
//~ os << this->ptr()->_m_curve;
os << ",";
os << this->ptr()->_m_arcno;
//~ os << this->ptr()->_m_arcno;
os << ",";
os << this->ptr()->_m_location;
//~ os << this->ptr()->_m_location;

os << ")";

Expand Down
Loading

0 comments on commit 86a13fa

Please sign in to comment.