mirror of https://github.com/CGAL/cgal
remove Object from Minkowski_sum_2
This commit is contained in:
parent
76f16d7c38
commit
fb2f2c6642
|
|
@ -584,9 +584,6 @@ public:
|
||||||
template <typename OutputIterator>
|
template <typename OutputIterator>
|
||||||
OutputIterator operator()(const Curve_2& cv, OutputIterator oi) const
|
OutputIterator operator()(const Curve_2& cv, OutputIterator oi) const
|
||||||
{
|
{
|
||||||
typedef std::variant<Point_2, X_monotone_curve_2>
|
|
||||||
Make_x_monotone_result;
|
|
||||||
|
|
||||||
// Increment the serial number of the curve cv, which will serve as its
|
// Increment the serial number of the curve cv, which will serve as its
|
||||||
// unique identifier.
|
// unique identifier.
|
||||||
unsigned int index = 0;
|
unsigned int index = 0;
|
||||||
|
|
@ -594,10 +591,10 @@ public:
|
||||||
|
|
||||||
if (cv.orientation() == COLLINEAR) {
|
if (cv.orientation() == COLLINEAR) {
|
||||||
// The curve is a line segment.
|
// The curve is a line segment.
|
||||||
*oi++ = Make_x_monotone_result(X_monotone_curve_2(cv.supporting_line(),
|
*oi++ = X_monotone_curve_2(cv.supporting_line(),
|
||||||
cv.source(),
|
cv.source(),
|
||||||
cv.target(),
|
cv.target(),
|
||||||
index));
|
index);
|
||||||
return oi;
|
return oi;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -608,8 +605,8 @@ public:
|
||||||
|
|
||||||
if (sign_rad == ZERO) {
|
if (sign_rad == ZERO) {
|
||||||
// Create an isolated point.
|
// Create an isolated point.
|
||||||
*oi++ = Make_x_monotone_result(Point_2(circ.center().x(),
|
*oi++ = Point_2(circ.center().x(),
|
||||||
circ.center().y()));
|
circ.center().y());
|
||||||
return oi;
|
return oi;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -622,59 +619,59 @@ public:
|
||||||
CGAL_assertion (n_vpts == 2);
|
CGAL_assertion (n_vpts == 2);
|
||||||
|
|
||||||
// Subdivide the circle into two arcs (an upper and a lower half).
|
// Subdivide the circle into two arcs (an upper and a lower half).
|
||||||
*oi++ = Make_x_monotone_result(X_monotone_curve_2(circ,
|
*oi++ = X_monotone_curve_2(circ,
|
||||||
vpts[0], vpts[1],
|
vpts[0], vpts[1],
|
||||||
cv.orientation(),
|
cv.orientation(),
|
||||||
index));
|
index);
|
||||||
|
|
||||||
*oi++ = Make_x_monotone_result(X_monotone_curve_2(circ,
|
*oi++ = X_monotone_curve_2(circ,
|
||||||
vpts[1], vpts[0],
|
vpts[1], vpts[0],
|
||||||
cv.orientation(),
|
cv.orientation(),
|
||||||
index));
|
index);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Act according to the number of vertical tangency points.
|
// Act according to the number of vertical tangency points.
|
||||||
if (n_vpts == 2) {
|
if (n_vpts == 2) {
|
||||||
// Subdivide the circular arc into three x-monotone arcs.
|
// Subdivide the circular arc into three x-monotone arcs.
|
||||||
*oi++ = Make_x_monotone_result(X_monotone_curve_2(circ,
|
*oi++ = X_monotone_curve_2(circ,
|
||||||
cv.source(), vpts[0],
|
cv.source(), vpts[0],
|
||||||
cv.orientation(),
|
cv.orientation(),
|
||||||
index));
|
index);
|
||||||
|
|
||||||
*oi++ = Make_x_monotone_result(X_monotone_curve_2(circ,
|
*oi++ = X_monotone_curve_2(circ,
|
||||||
vpts[0], vpts[1],
|
vpts[0], vpts[1],
|
||||||
cv.orientation(),
|
cv.orientation(),
|
||||||
index));
|
index);
|
||||||
|
|
||||||
*oi++ = Make_x_monotone_result(X_monotone_curve_2(circ,
|
*oi++ = X_monotone_curve_2(circ,
|
||||||
vpts[1],
|
vpts[1],
|
||||||
cv.target(),
|
cv.target(),
|
||||||
cv.orientation(),
|
cv.orientation(),
|
||||||
index));
|
index);
|
||||||
}
|
}
|
||||||
else if (n_vpts == 1) {
|
else if (n_vpts == 1) {
|
||||||
// Subdivide the circular arc into two x-monotone arcs.
|
// Subdivide the circular arc into two x-monotone arcs.
|
||||||
*oi++ = Make_x_monotone_result(X_monotone_curve_2(circ,
|
*oi++ = X_monotone_curve_2(circ,
|
||||||
cv.source(),
|
cv.source(),
|
||||||
vpts[0],
|
vpts[0],
|
||||||
cv.orientation(),
|
cv.orientation(),
|
||||||
index));
|
index);
|
||||||
|
|
||||||
*oi++ = Make_x_monotone_result(X_monotone_curve_2(circ,
|
*oi++ = X_monotone_curve_2(circ,
|
||||||
vpts[0],
|
vpts[0],
|
||||||
cv.target(),
|
cv.target(),
|
||||||
cv.orientation(),
|
cv.orientation(),
|
||||||
index));
|
index);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
CGAL_assertion(n_vpts == 0);
|
CGAL_assertion(n_vpts == 0);
|
||||||
|
|
||||||
// The arc is already x-monotone:
|
// The arc is already x-monotone:
|
||||||
*oi++ = Make_x_monotone_result(X_monotone_curve_2(circ,
|
*oi++ = X_monotone_curve_2(circ,
|
||||||
cv.source(),
|
cv.source(),
|
||||||
cv.target(),
|
cv.target(),
|
||||||
cv.orientation(),
|
cv.orientation(),
|
||||||
index));
|
index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -168,12 +168,10 @@ protected:
|
||||||
typename Kernel::Orientation_2 f_orient = ker.orientation_2_object();
|
typename Kernel::Orientation_2 f_orient = ker.orientation_2_object();
|
||||||
|
|
||||||
Traits_2 traits;
|
Traits_2 traits;
|
||||||
std::list<Object> xobjs;
|
std::list<std::variant<Tr_point_2, X_monotone_curve_2>> xobjs;
|
||||||
std::list<Object>::iterator xobj_it;
|
|
||||||
typename Traits_2::Make_x_monotone_2
|
typename Traits_2::Make_x_monotone_2
|
||||||
f_make_x_monotone = traits.make_x_monotone_2_object();
|
f_make_x_monotone = traits.make_x_monotone_2_object();
|
||||||
Curve_2 arc;
|
Curve_2 arc;
|
||||||
X_monotone_curve_2 xarc;
|
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
|
@ -517,12 +515,11 @@ protected:
|
||||||
// convolution cycle.
|
// convolution cycle.
|
||||||
xobjs.clear();
|
xobjs.clear();
|
||||||
f_make_x_monotone (arc, std::back_inserter(xobjs));
|
f_make_x_monotone (arc, std::back_inserter(xobjs));
|
||||||
for (xobj_it = xobjs.begin(); xobj_it != xobjs.end(); ++xobj_it) {
|
for (auto xobj_it = xobjs.begin(); xobj_it != xobjs.end(); ++xobj_it) {
|
||||||
assign_success = CGAL::assign (xarc, *xobj_it);
|
const X_monotone_curve_2* xarc = std::get_if<X_monotone_curve_2>(&(*xobj_it));
|
||||||
CGAL_assertion (assign_success);
|
CGAL_assertion(xarc!=nullptr);
|
||||||
CGAL_USE(assign_success);
|
*oi++ = Labeled_curve_2 (*xarc,
|
||||||
*oi++ = Labeled_curve_2 (xarc,
|
X_curve_label (xarc->is_directed_right(),
|
||||||
X_curve_label (xarc.is_directed_right(),
|
|
||||||
cycle_id, curve_index++));
|
cycle_id, curve_index++));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -571,18 +568,17 @@ protected:
|
||||||
xobjs.clear();
|
xobjs.clear();
|
||||||
f_make_x_monotone (arc, std::back_inserter(xobjs));
|
f_make_x_monotone (arc, std::back_inserter(xobjs));
|
||||||
|
|
||||||
xobj_it = xobjs.begin();
|
auto xobj_it = xobjs.begin();
|
||||||
while (xobj_it != xobjs.end())
|
while (xobj_it != xobjs.end())
|
||||||
{
|
{
|
||||||
assign_success = CGAL::assign (xarc, *xobj_it);
|
const X_monotone_curve_2* xarc = std::get_if<X_monotone_curve_2>(&(*xobj_it));
|
||||||
CGAL_assertion (assign_success);
|
CGAL_assertion (xarc != nullptr);
|
||||||
CGAL_USE(assign_success);
|
|
||||||
|
|
||||||
++xobj_it;
|
++xobj_it;
|
||||||
bool is_last = (xobj_it == xobjs.end());
|
bool is_last = (xobj_it == xobjs.end());
|
||||||
|
|
||||||
*oi++ = Labeled_curve_2 (xarc,
|
*oi++ = Labeled_curve_2 (*xarc,
|
||||||
X_curve_label (xarc.is_directed_right(),
|
X_curve_label (xarc->is_directed_right(),
|
||||||
cycle_id, curve_index++, is_last));
|
cycle_id, curve_index++, is_last));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -117,7 +117,7 @@ protected:
|
||||||
Algebraic a, b, c;
|
Algebraic a, b, c;
|
||||||
|
|
||||||
unsigned int curve_index(0);
|
unsigned int curve_index(0);
|
||||||
std::list<Object> xobjs;
|
std::list<std::variant<typename Traits_2::Point_2,X_monotone_curve_2>> xobjs;
|
||||||
|
|
||||||
Traits_2 traits;
|
Traits_2 traits;
|
||||||
auto nt_traits = traits.nt_traits();
|
auto nt_traits = traits.nt_traits();
|
||||||
|
|
@ -127,8 +127,6 @@ protected:
|
||||||
auto alg_ker = traits.alg_kernel();
|
auto alg_ker = traits.alg_kernel();
|
||||||
auto f_equal = alg_ker->equal_2_object();
|
auto f_equal = alg_ker->equal_2_object();
|
||||||
|
|
||||||
bool assign_success;
|
|
||||||
|
|
||||||
do {
|
do {
|
||||||
// Get a circulator for the next vertex (in the proper orientation).
|
// Get a circulator for the next vertex (in the proper orientation).
|
||||||
if (forward) ++next;
|
if (forward) ++next;
|
||||||
|
|
@ -185,13 +183,11 @@ protected:
|
||||||
f_make_x_monotone(arc, std::back_inserter(xobjs));
|
f_make_x_monotone(arc, std::back_inserter(xobjs));
|
||||||
|
|
||||||
for (auto xobj_it = xobjs.begin(); xobj_it != xobjs.end(); ++xobj_it) {
|
for (auto xobj_it = xobjs.begin(); xobj_it != xobjs.end(); ++xobj_it) {
|
||||||
X_monotone_curve_2 xarc;
|
const X_monotone_curve_2* xarc = std::get_if<X_monotone_curve_2>(&(*xobj_it));
|
||||||
assign_success = CGAL::assign(xarc, *xobj_it);
|
CGAL_assertion (xarc!=nullptr);
|
||||||
CGAL_assertion (assign_success);
|
|
||||||
CGAL_USE(assign_success);
|
|
||||||
|
|
||||||
*oi++ = Labeled_curve_2(xarc, X_curve_label(xarc.is_directed_right(),
|
*oi++ = Labeled_curve_2(*xarc, X_curve_label(xarc->is_directed_right(),
|
||||||
cycle_id, curve_index));
|
cycle_id, curve_index));
|
||||||
curve_index++;
|
curve_index++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -237,15 +233,13 @@ protected:
|
||||||
|
|
||||||
auto xobj_it = xobjs.begin();
|
auto xobj_it = xobjs.begin();
|
||||||
while (xobj_it != xobjs.end()) {
|
while (xobj_it != xobjs.end()) {
|
||||||
X_monotone_curve_2 xarc;
|
const X_monotone_curve_2* xarc = std::get_if<X_monotone_curve_2>(&(*xobj_it));
|
||||||
assign_success = CGAL::assign(xarc, *xobj_it);
|
CGAL_assertion (xarc!=nullptr);
|
||||||
CGAL_assertion (assign_success);
|
|
||||||
CGAL_USE(assign_success);
|
|
||||||
|
|
||||||
++xobj_it;
|
++xobj_it;
|
||||||
is_last = (xobj_it == xobjs.end());
|
is_last = (xobj_it == xobjs.end());
|
||||||
|
|
||||||
*oi++ = Labeled_curve_2(xarc, X_curve_label(xarc.is_directed_right(),
|
*oi++ = Labeled_curve_2(*xarc, X_curve_label(xarc->is_directed_right(),
|
||||||
cycle_id, curve_index,
|
cycle_id, curve_index,
|
||||||
is_last));
|
is_last));
|
||||||
curve_index++;
|
curve_index++;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue