mirror of https://github.com/CGAL/cgal
fix argt demo
changes in Arrangement_on_surface_2/include/CGAL/Arr_polycurve_traits_2.h should be undo
This commit is contained in:
parent
f06d9fb606
commit
89fd91e354
|
|
@ -961,15 +961,16 @@ findOtherInterestingPoints<demo_types::DemoTypes::Alg_seg_arr>
|
||||||
const CGAL::Bbox_2& allowable_range) {
|
const CGAL::Bbox_2& allowable_range) {
|
||||||
using Traits = demo_types::DemoTypes::Alg_seg_traits;
|
using Traits = demo_types::DemoTypes::Alg_seg_traits;
|
||||||
CGAL::Bbox_2 bb = {};
|
CGAL::Bbox_2 bb = {};
|
||||||
std::vector<CGAL::Object> intersections;
|
typedef std::pair<typename Traits::Point_2, unsigned int> Pt_m;
|
||||||
|
std::vector<Pt_m> intersections;
|
||||||
for (auto it = arr->edges_begin(); it != arr->edges_end(); ++it) {
|
for (auto it = arr->edges_begin(); it != arr->edges_end(); ++it) {
|
||||||
for (auto& arc : getXyCurves(arr->traits()))
|
for (auto& arc : getXyCurves(arr->traits()))
|
||||||
|
{
|
||||||
if (arc.is_vertical() != it->curve().is_vertical())
|
if (arc.is_vertical() != it->curve().is_vertical())
|
||||||
it->curve().intersections(arc, std::back_inserter(intersections));
|
it->curve().intersections(arc, CGAL::dispatch_or_drop_output<Pt_m>(std::back_inserter(intersections)));
|
||||||
}
|
}
|
||||||
for (auto it = intersections.begin(); it != intersections.end(); it++) {
|
}
|
||||||
std::pair<typename Traits::Point_2, unsigned int> point_multiplicity;
|
for (auto point_multiplicity :intersections) {
|
||||||
CGAL::assign(point_multiplicity, *it);
|
|
||||||
auto& point = point_multiplicity.first;
|
auto& point = point_multiplicity.first;
|
||||||
if (point.location() == CGAL::ARR_INTERIOR) {
|
if (point.location() == CGAL::ARR_INTERIOR) {
|
||||||
auto xy = point.to_double();
|
auto xy = point.to_double();
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,8 @@
|
||||||
|
|
||||||
#include "IntersectCurves.h"
|
#include "IntersectCurves.h"
|
||||||
#include "ArrangementTypes.h"
|
#include "ArrangementTypes.h"
|
||||||
|
#include <boost/function_output_iterator.hpp>
|
||||||
|
|
||||||
|
|
||||||
template <typename Traits_>
|
template <typename Traits_>
|
||||||
Intersect_curves<Traits_>::Intersect_curves(const Traits* traits) :
|
Intersect_curves<Traits_>::Intersect_curves(const Traits* traits) :
|
||||||
|
|
@ -18,12 +20,26 @@ Intersect_curves<Traits_>::Intersect_curves(const Traits* traits) :
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct Object_putter
|
||||||
|
{
|
||||||
|
std::vector<CGAL::Object>& v;
|
||||||
|
Object_putter(std::vector<CGAL::Object>& v)
|
||||||
|
: v(v)
|
||||||
|
{}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
void operator()(const T& t)
|
||||||
|
{
|
||||||
|
v.push_back(make_object(t));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
template <typename Traits_>
|
template <typename Traits_>
|
||||||
void Intersect_curves<Traits_>::operator()(
|
void Intersect_curves<Traits_>::operator()(
|
||||||
const X_monotone_curve_2& cv1, const X_monotone_curve_2& cv2,
|
const X_monotone_curve_2& cv1, const X_monotone_curve_2& cv2,
|
||||||
std::vector<CGAL::Object>& output)
|
std::vector<CGAL::Object>& output)
|
||||||
{
|
{
|
||||||
this->intersect(cv1, cv2, std::back_inserter(output));
|
this->intersect(cv1, cv2, boost::make_function_output_iterator(Object_putter(output)));
|
||||||
}
|
}
|
||||||
|
|
||||||
ARRANGEMENT_DEMO_SPECIALIZE_TRAITS(Intersect_curves)
|
ARRANGEMENT_DEMO_SPECIALIZE_TRAITS(Intersect_curves)
|
||||||
|
|
|
||||||
|
|
@ -625,14 +625,14 @@ operator()(const X_monotone_curve_2& curve, const CoordinateType& x,
|
||||||
Point_2 p2c1(x, CoordinateType(clipRect.ymax() + 1));
|
Point_2 p2c1(x, CoordinateType(clipRect.ymax() + 1));
|
||||||
|
|
||||||
const X_monotone_curve_2 verticalLine = ctr_xcv(p1c1, p2c1);
|
const X_monotone_curve_2 verticalLine = ctr_xcv(p1c1, p2c1);
|
||||||
CGAL::Object o;
|
std::vector<IntersectionResult> pairs;
|
||||||
CGAL::Oneset_iterator<CGAL::Object> oi(o);
|
|
||||||
|
|
||||||
this->intersectCurves(curve, verticalLine, oi);
|
this->intersectCurves(curve, verticalLine,
|
||||||
|
CGAL::dispatch_or_drop_output<IntersectionResult>(std::back_inserter(pairs)));
|
||||||
|
|
||||||
IntersectionResult pair;
|
IntersectionResult pair;
|
||||||
if (CGAL::assign(pair, o)) {
|
if (!pairs.empty()) {
|
||||||
Point_2 pt = pair.first;
|
Point_2 pt = pairs[0].first;
|
||||||
res = pt.y();
|
res = pt.y();
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
|
|
@ -654,14 +654,13 @@ operator()(const X_monotone_curve_2& curve, const CoordinateType& x,
|
||||||
Point_2 p2c1(x, CoordinateType(10000000)); // upper bounding box
|
Point_2 p2c1(x, CoordinateType(10000000)); // upper bounding box
|
||||||
|
|
||||||
const X_monotone_curve_2 verticalLine = ctr_xcv(p1c1, p2c1);
|
const X_monotone_curve_2 verticalLine = ctr_xcv(p1c1, p2c1);
|
||||||
CGAL::Object o;
|
std::vector<IntersectionResult> pairs;
|
||||||
CGAL::Oneset_iterator<CGAL::Object> oi(o);
|
|
||||||
|
|
||||||
this->intersectCurves(curve, verticalLine, oi);
|
this->intersectCurves(curve, verticalLine,
|
||||||
|
CGAL::dispatch_or_drop_output<IntersectionResult>(std::back_inserter(pairs)));
|
||||||
|
|
||||||
IntersectionResult pair;
|
if (!pairs.empty()) {
|
||||||
if (CGAL::assign(pair, o)) {
|
Point_2 pt = pairs[0].first;
|
||||||
Point_2 pt = pair.first;
|
|
||||||
res = pt.y();
|
res = pt.y();
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
|
|
@ -681,15 +680,15 @@ operator()(const X_monotone_curve_2& curve, const Coordinate_type& x)
|
||||||
Point_2 p2c1(x, Coordinate_type(clip_rect.ymax() + 1));
|
Point_2 p2c1(x, Coordinate_type(clip_rect.ymax() + 1));
|
||||||
|
|
||||||
const X_monotone_curve_2 vertical_line = ctr_xcv(p1c1, p2c1);
|
const X_monotone_curve_2 vertical_line = ctr_xcv(p1c1, p2c1);
|
||||||
CGAL::Object o;
|
|
||||||
CGAL::Oneset_iterator<CGAL::Object> oi(o);
|
|
||||||
|
|
||||||
this->intersect_curves(curve, vertical_line, oi);
|
std::vector<IntersectionResult> pairs;
|
||||||
|
|
||||||
|
this->intersect_curves(curve, vertical_line,
|
||||||
|
CGAL::dispatch_or_drop_output<IntersectionResult>(std::back_inserter(pairs)));
|
||||||
|
|
||||||
Coordinate_type res(0);
|
Coordinate_type res(0);
|
||||||
IntersectionResult pair;
|
if (!pairs.empty()) {
|
||||||
if (CGAL::assign(pair, o)) {
|
Point_2 pt = pairs[0].first;
|
||||||
Point_2 pt = pair.first;
|
|
||||||
res = pt.y();
|
res = pt.y();
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
|
|
@ -708,15 +707,15 @@ auto Arr_compute_y_at_x_2<CGAL::Arr_algebraic_segment_traits_2<Coefficient_>>::
|
||||||
operator()(const X_monotone_curve_2& curve, const CoordinateType& x)
|
operator()(const X_monotone_curve_2& curve, const CoordinateType& x)
|
||||||
-> CoordinateType
|
-> CoordinateType
|
||||||
{
|
{
|
||||||
CGAL::Object o;
|
|
||||||
CGAL::Oneset_iterator<CGAL::Object> oi(o);
|
|
||||||
Intersect_2 intersect = traits->intersect_2_object();
|
Intersect_2 intersect = traits->intersect_2_object();
|
||||||
X_monotone_curve_2 c2 = this->makeVerticalLine(x);
|
X_monotone_curve_2 c2 = this->makeVerticalLine(x);
|
||||||
intersect(curve, c2, oi);
|
typedef std::pair<Point_2, Multiplicity> PtM;
|
||||||
std::pair<Point_2, Multiplicity> res;
|
|
||||||
if (CGAL::assign(res, o)) {
|
std::vector<PtM> res;
|
||||||
|
intersect(curve, c2, CGAL::dispatch_or_drop_output<PtM>(std::back_inserter(res)));
|
||||||
|
if (!res.empty()) {
|
||||||
// TODO: handle failure case
|
// TODO: handle failure case
|
||||||
const Point_2& p = res.first;
|
const Point_2& p = res[0].first;
|
||||||
CoordinateType coord = p.y();
|
CoordinateType coord = p.y();
|
||||||
return coord;
|
return coord;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -826,7 +826,7 @@ public:
|
||||||
std::get_if<X_monotone_subcurve_2>(&xection);
|
std::get_if<X_monotone_subcurve_2>(&xection);
|
||||||
if (subcv_p != nullptr) {
|
if (subcv_p != nullptr) {
|
||||||
ocv.push_back(*subcv_p);
|
ocv.push_back(*subcv_p);
|
||||||
oi = output_ocv (ocv, invert_ocv, oi);
|
output_ocv (ocv, invert_ocv, oi);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -883,7 +883,7 @@ public:
|
||||||
// An overlap occurred at the previous iteration:
|
// An overlap occurred at the previous iteration:
|
||||||
// Output the overlapping polycurve.
|
// Output the overlapping polycurve.
|
||||||
CGAL_assertion(ocv.size() > 0);
|
CGAL_assertion(ocv.size() > 0);
|
||||||
oi = output_ocv (ocv, invert_ocv, oi);
|
output_ocv (ocv, invert_ocv, oi);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// The left point of the current subcurve of one
|
// The left point of the current subcurve of one
|
||||||
|
|
@ -929,7 +929,7 @@ public:
|
||||||
|
|
||||||
// Output the remaining overlapping polycurve, if necessary.
|
// Output the remaining overlapping polycurve, if necessary.
|
||||||
if (ocv.size() > 0) {
|
if (ocv.size() > 0) {
|
||||||
oi = output_ocv (ocv, invert_ocv, oi);
|
output_ocv (ocv, invert_ocv, oi);
|
||||||
}
|
}
|
||||||
else if (right_coincides) {
|
else if (right_coincides) {
|
||||||
typedef std::pair<Point_2,Multiplicity> return_point;
|
typedef std::pair<Point_2,Multiplicity> return_point;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue