mirror of https://github.com/CGAL/cgal
Further eliminating CGAL::Object
This commit is contained in:
parent
40152a2582
commit
3849f5e154
|
|
@ -61,6 +61,9 @@ private:
|
||||||
typedef typename Arrangement_2::DInner_ccb DInner_ccb;
|
typedef typename Arrangement_2::DInner_ccb DInner_ccb;
|
||||||
typedef typename Arrangement_2::DIso_vertex DIso_vertex;
|
typedef typename Arrangement_2::DIso_vertex DIso_vertex;
|
||||||
|
|
||||||
|
typedef Arr_point_location_result<Arrangement_2> Pl_result;
|
||||||
|
typedef typename Pl_result::Type Pl_result_type;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Arrangement_2* p_arr; // The associated arrangement.
|
Arrangement_2* p_arr; // The associated arrangement.
|
||||||
|
|
||||||
|
|
@ -100,32 +103,25 @@ public:
|
||||||
* This object may wrap a Face_const_handle (the general case),
|
* This object may wrap a Face_const_handle (the general case),
|
||||||
* or a Halfedge_const_handle (in case of an overlap).
|
* or a Halfedge_const_handle (in case of an overlap).
|
||||||
*/
|
*/
|
||||||
typedef Arr_point_location_result<Arrangement_2> Pl_result;
|
Pl_result_type locate_curve_end(const X_monotone_curve_2& cv,
|
||||||
typename Pl_result::type locate_curve_end(const X_monotone_curve_2& cv,
|
|
||||||
Arr_curve_end ind,
|
Arr_curve_end ind,
|
||||||
Arr_parameter_space ps_x,
|
Arr_parameter_space ps_x,
|
||||||
Arr_parameter_space ps_y) const
|
Arr_parameter_space ps_y) const
|
||||||
{
|
{
|
||||||
CGAL_precondition((ps_x != ARR_INTERIOR) || (ps_y != ARR_INTERIOR));
|
CGAL_precondition((ps_x != ARR_INTERIOR) || (ps_y != ARR_INTERIOR));
|
||||||
|
|
||||||
typedef Arr_point_location_result<Arrangement_2> Pl_result;
|
|
||||||
|
|
||||||
// Use the topology traits to locate the unbounded curve end.
|
// Use the topology traits to locate the unbounded curve end.
|
||||||
CGAL::Object obj =
|
auto obj = p_arr->topology_traits()->locate_curve_end(cv, ind, ps_x, ps_y);
|
||||||
p_arr->topology_traits()->locate_curve_end(cv, ind, ps_x, ps_y);
|
|
||||||
|
|
||||||
// Return a handle to the DCEL feature.
|
// Return a handle to the DCEL feature.
|
||||||
DFace* f;
|
DFace** f_p = boost::get<DFace*>(&obj);
|
||||||
if (CGAL::assign(f, obj))
|
if (f_p) return (Pl_result::make_result(p_arr->_const_handle_for(*f_p)));
|
||||||
return (Pl_result::make_result(p_arr->_const_handle_for(f)));
|
|
||||||
|
|
||||||
DHalfedge* he;
|
DHalfedge** he_p = boost::get<DHalfedge*>(&obj);
|
||||||
if (CGAL::assign(he, obj))
|
if (he_p) return (Pl_result::make_result(p_arr->_const_handle_for(*he_p)));
|
||||||
return (Pl_result::make_result(p_arr->_const_handle_for(he)));
|
|
||||||
|
|
||||||
DVertex* v;
|
DVertex** v_p = boost::get<DVertex*>(&obj);
|
||||||
if (CGAL::assign(v, obj))
|
if (v_p) return (Pl_result::make_result(p_arr->_const_handle_for(*v_p)));
|
||||||
return (Pl_result::make_result(p_arr->_const_handle_for(v)));
|
|
||||||
|
|
||||||
// We should never reach here:
|
// We should never reach here:
|
||||||
CGAL_error();
|
CGAL_error();
|
||||||
|
|
|
||||||
|
|
@ -7,14 +7,15 @@
|
||||||
// $Id$
|
// $Id$
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial
|
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial
|
||||||
//
|
//
|
||||||
//
|
// Author(s): Ron Wein <wein@post.tau.ac.il>
|
||||||
// Author(s) : Ron Wein <wein@post.tau.ac.il>
|
|
||||||
// Efi Fogel <efif@post.tau.ac.il>
|
// Efi Fogel <efif@post.tau.ac.il>
|
||||||
// Eric Berberich <ericb@post.tau.ac.il>
|
// Eric Berberich <ericb@post.tau.ac.il>
|
||||||
|
|
||||||
#ifndef CGAL_ARR_BOUNDED_PLANAR_TOPOLOGY_TRAITS_2_H
|
#ifndef CGAL_ARR_BOUNDED_PLANAR_TOPOLOGY_TRAITS_2_H
|
||||||
#define CGAL_ARR_BOUNDED_PLANAR_TOPOLOGY_TRAITS_2_H
|
#define CGAL_ARR_BOUNDED_PLANAR_TOPOLOGY_TRAITS_2_H
|
||||||
|
|
||||||
|
#include <boost/variant.hpp>
|
||||||
|
|
||||||
#include <CGAL/license/Arrangement_on_surface_2.h>
|
#include <CGAL/license/Arrangement_on_surface_2.h>
|
||||||
|
|
||||||
#include <CGAL/disable_warnings.h>
|
#include <CGAL/disable_warnings.h>
|
||||||
|
|
@ -306,9 +307,10 @@ public:
|
||||||
* \param ps_x The boundary condition of the curve end in x.
|
* \param ps_x The boundary condition of the curve end in x.
|
||||||
* \param ps_y The boundary condition of the curve end in y.
|
* \param ps_y The boundary condition of the curve end in y.
|
||||||
* \pre The curve has a boundary condition in either x or y.
|
* \pre The curve has a boundary condition in either x or y.
|
||||||
* \return An object that contains the curve end.
|
* \return An object that wraps the curve end.
|
||||||
*/
|
*/
|
||||||
CGAL::Object place_boundary_vertex(Face*,
|
boost::optional<boost::variant<Vertex*, Halfedge*> >
|
||||||
|
place_boundary_vertex(Face*,
|
||||||
const X_monotone_curve_2&,
|
const X_monotone_curve_2&,
|
||||||
Arr_curve_end,
|
Arr_curve_end,
|
||||||
Arr_parameter_space /* ps_x */,
|
Arr_parameter_space /* ps_x */,
|
||||||
|
|
@ -316,7 +318,7 @@ public:
|
||||||
{
|
{
|
||||||
// This function should never be called:
|
// This function should never be called:
|
||||||
CGAL_error();
|
CGAL_error();
|
||||||
return CGAL::Object();
|
return boost::none;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Locate the predecessor halfedge for the given curve around a given
|
/*! Locate the predecessor halfedge for the given curve around a given
|
||||||
|
|
@ -349,14 +351,17 @@ public:
|
||||||
* \pre The curve end is incident to the boundary.
|
* \pre The curve end is incident to the boundary.
|
||||||
* \return An object that contains the curve end.
|
* \return An object that contains the curve end.
|
||||||
*/
|
*/
|
||||||
CGAL::Object locate_curve_end(const X_monotone_curve_2&,
|
boost::variant<Vertex*, Halfedge*, Face*>
|
||||||
|
locate_curve_end(const X_monotone_curve_2&,
|
||||||
Arr_curve_end,
|
Arr_curve_end,
|
||||||
Arr_parameter_space /* ps_x */,
|
Arr_parameter_space /* ps_x */,
|
||||||
Arr_parameter_space /* ps_y */)
|
Arr_parameter_space /* ps_y */)
|
||||||
{
|
{
|
||||||
|
typedef boost::variant<Vertex*, Halfedge*, Face*> Result;
|
||||||
// This function should never be called:
|
// This function should never be called:
|
||||||
CGAL_error();
|
CGAL_error();
|
||||||
return Object();
|
Vertex* v(nullptr);
|
||||||
|
return Result(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Split a fictitious edge using the given vertex.
|
/*! Split a fictitious edge using the given vertex.
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
// $Id$
|
// $Id$
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial
|
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial
|
||||||
//
|
//
|
||||||
// Author(s) : Efi Fogel <efif@post.tau.ac.il>
|
// Author(s): Efi Fogel <efif@post.tau.ac.il>
|
||||||
// Eric Berberich <ericb@post.tau.ac.il>
|
// Eric Berberich <ericb@post.tau.ac.il>
|
||||||
|
|
||||||
#ifndef CGAL_ARR_SPHERICAL_TOPOLOGY_TRAITS_2_H
|
#ifndef CGAL_ARR_SPHERICAL_TOPOLOGY_TRAITS_2_H
|
||||||
|
|
@ -491,7 +491,8 @@ public:
|
||||||
* \pre The curve has a boundary condition in either x or y.
|
* \pre The curve has a boundary condition in either x or y.
|
||||||
* \return An object that contains the curve end.
|
* \return An object that contains the curve end.
|
||||||
*/
|
*/
|
||||||
CGAL::Object place_boundary_vertex(Face* f,
|
boost::optional<boost::variant<Vertex*, Halfedge*> >
|
||||||
|
place_boundary_vertex(Face* f,
|
||||||
const X_monotone_curve_2& xc,
|
const X_monotone_curve_2& xc,
|
||||||
Arr_curve_end ind,
|
Arr_curve_end ind,
|
||||||
Arr_parameter_space ps_x,
|
Arr_parameter_space ps_x,
|
||||||
|
|
@ -522,7 +523,8 @@ public:
|
||||||
* \pre The curve end is incident to the boundary.
|
* \pre The curve end is incident to the boundary.
|
||||||
* \return An object that contains the curve end.
|
* \return An object that contains the curve end.
|
||||||
*/
|
*/
|
||||||
CGAL::Object locate_curve_end(const X_monotone_curve_2& xc, Arr_curve_end ce,
|
boost::variant<Vertex*, Halfedge*, Face*>
|
||||||
|
locate_curve_end(const X_monotone_curve_2& xc, Arr_curve_end ce,
|
||||||
Arr_parameter_space ps_x,
|
Arr_parameter_space ps_x,
|
||||||
Arr_parameter_space ps_y);
|
Arr_parameter_space ps_y);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
// $Id$
|
// $Id$
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial
|
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial
|
||||||
//
|
//
|
||||||
// Author(s) : Efi Fogel <efif@post.tau.ac.il>
|
// Author(s): Efi Fogel <efif@post.tau.ac.il>
|
||||||
// Ron Wein <wein@post.tau.ac.il>
|
// Ron Wein <wein@post.tau.ac.il>
|
||||||
|
|
||||||
#ifndef CGAL_ARR_SPHERICAL_TOPOLOGY_TRAITS_2_IMPL_H
|
#ifndef CGAL_ARR_SPHERICAL_TOPOLOGY_TRAITS_2_IMPL_H
|
||||||
|
|
@ -514,7 +514,10 @@ let_me_decide_the_outer_ccb(std::pair< CGAL::Sign, CGAL::Sign> signs1,
|
||||||
* the interior of the curve, find a place for a boundary vertex that will
|
* the interior of the curve, find a place for a boundary vertex that will
|
||||||
* represent the curve end along the face boundary */
|
* represent the curve end along the face boundary */
|
||||||
template <typename GeomTraits, typename Dcel>
|
template <typename GeomTraits, typename Dcel>
|
||||||
CGAL::Object
|
boost::optional
|
||||||
|
<boost::variant
|
||||||
|
<typename Arr_spherical_topology_traits_2<GeomTraits, Dcel>::Vertex*,
|
||||||
|
typename Arr_spherical_topology_traits_2<GeomTraits, Dcel>::Halfedge*> >
|
||||||
Arr_spherical_topology_traits_2<GeomTraits, Dcel>::
|
Arr_spherical_topology_traits_2<GeomTraits, Dcel>::
|
||||||
place_boundary_vertex(Face* /* f */,
|
place_boundary_vertex(Face* /* f */,
|
||||||
const X_monotone_curve_2& xc, Arr_curve_end ind,
|
const X_monotone_curve_2& xc, Arr_curve_end ind,
|
||||||
|
|
@ -525,15 +528,18 @@ place_boundary_vertex(Face* /* f */,
|
||||||
,
|
,
|
||||||
Arr_parameter_space ps_y)
|
Arr_parameter_space ps_y)
|
||||||
{
|
{
|
||||||
|
typedef boost::variant<Vertex*, Halfedge*> Non_optional_result;
|
||||||
|
typedef boost::optional<Non_optional_result> Result;
|
||||||
|
|
||||||
// std::cout << "place_boundary_vertex()" << std::endl;
|
// std::cout << "place_boundary_vertex()" << std::endl;
|
||||||
if (ps_y == ARR_BOTTOM_BOUNDARY) {
|
if (ps_y == ARR_BOTTOM_BOUNDARY) {
|
||||||
if (m_south_pole == nullptr) return Object();
|
if (m_south_pole == nullptr) return boost::none;
|
||||||
return CGAL::make_object(m_south_pole);
|
return Result(Non_optional_result(m_south_pole));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ps_y == ARR_TOP_BOUNDARY) {
|
if (ps_y == ARR_TOP_BOUNDARY) {
|
||||||
if (m_north_pole == nullptr) return Object();
|
if (m_north_pole == nullptr) return boost::none;
|
||||||
return CGAL::make_object(m_north_pole);
|
return Result(Non_optional_result(m_north_pole));
|
||||||
}
|
}
|
||||||
|
|
||||||
CGAL_assertion((ps_x == ARR_LEFT_BOUNDARY) || (ps_x == ARR_RIGHT_BOUNDARY));
|
CGAL_assertion((ps_x == ARR_LEFT_BOUNDARY) || (ps_x == ARR_RIGHT_BOUNDARY));
|
||||||
|
|
@ -541,15 +547,14 @@ place_boundary_vertex(Face* /* f */,
|
||||||
const Point_2& key = (ind == ARR_MIN_END) ?
|
const Point_2& key = (ind == ARR_MIN_END) ?
|
||||||
m_geom_traits->construct_min_vertex_2_object()(xc) :
|
m_geom_traits->construct_min_vertex_2_object()(xc) :
|
||||||
m_geom_traits->construct_max_vertex_2_object()(xc);
|
m_geom_traits->construct_max_vertex_2_object()(xc);
|
||||||
typename Vertex_map::iterator it = m_boundary_vertices.find(key);
|
auto it = m_boundary_vertices.find(key);
|
||||||
|
|
||||||
if (it != m_boundary_vertices.end()) {
|
if (it != m_boundary_vertices.end()) {
|
||||||
Vertex* v = it->second;
|
Vertex* v = it->second;
|
||||||
return CGAL::make_object(v);
|
return Result(Non_optional_result(v));
|
||||||
}
|
}
|
||||||
|
|
||||||
// The vertex hasn't been created yet, return a null object:
|
// The vertex hasn't been created yet, return a null object:
|
||||||
return Object();
|
return boost::none;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! \brief locate the predecessor halfedge for the given curve around a given
|
/*! \brief locate the predecessor halfedge for the given curve around a given
|
||||||
|
|
@ -585,7 +590,11 @@ locate_around_boundary_vertex(Vertex* v,
|
||||||
|
|
||||||
/*! \brief locates a DCEL feature that contains a given curve end. */
|
/*! \brief locates a DCEL feature that contains a given curve end. */
|
||||||
template <typename GeomTraits, typename Dcel>
|
template <typename GeomTraits, typename Dcel>
|
||||||
CGAL::Object Arr_spherical_topology_traits_2<GeomTraits, Dcel>::
|
boost::variant
|
||||||
|
<typename Arr_spherical_topology_traits_2<GeomTraits, Dcel>::Vertex*,
|
||||||
|
typename Arr_spherical_topology_traits_2<GeomTraits, Dcel>::Halfedge*,
|
||||||
|
typename Arr_spherical_topology_traits_2<GeomTraits, Dcel>::Face*>
|
||||||
|
Arr_spherical_topology_traits_2<GeomTraits, Dcel>::
|
||||||
locate_curve_end(const X_monotone_curve_2& xc, Arr_curve_end ind,
|
locate_curve_end(const X_monotone_curve_2& xc, Arr_curve_end ind,
|
||||||
Arr_parameter_space
|
Arr_parameter_space
|
||||||
#if !defined(CGAL_NO_ASSERTIONS)
|
#if !defined(CGAL_NO_ASSERTIONS)
|
||||||
|
|
@ -594,13 +603,14 @@ locate_curve_end(const X_monotone_curve_2& xc, Arr_curve_end ind,
|
||||||
,
|
,
|
||||||
Arr_parameter_space ps_y)
|
Arr_parameter_space ps_y)
|
||||||
{
|
{
|
||||||
|
typedef boost::variant<Vertex*, Halfedge*, Face*> Result;
|
||||||
// Act according to the boundary conditions.
|
// Act according to the boundary conditions.
|
||||||
if (ps_y == ARR_TOP_BOUNDARY) {
|
if (ps_y == ARR_TOP_BOUNDARY) {
|
||||||
// In case the curve end coincides with the north pole, return the vertex
|
// In case the curve end coincides with the north pole, return the vertex
|
||||||
// representing the north pole, if one exists. Otherwise, return the face
|
// representing the north pole, if one exists. Otherwise, return the face
|
||||||
// containing this pole (the spherical face).
|
// containing this pole (the spherical face).
|
||||||
if (m_north_pole != nullptr) return CGAL::make_object(m_north_pole);
|
if (m_north_pole != nullptr) return Result(m_north_pole);
|
||||||
return CGAL::make_object(m_spherical_face);
|
return Result(m_spherical_face);
|
||||||
}
|
}
|
||||||
|
|
||||||
typename Vertex_map::iterator it;
|
typename Vertex_map::iterator it;
|
||||||
|
|
@ -610,7 +620,7 @@ locate_curve_end(const X_monotone_curve_2& xc, Arr_curve_end ind,
|
||||||
// In case the curve end coincides with the south pole, return the vertex
|
// In case the curve end coincides with the south pole, return the vertex
|
||||||
// representing the south pole, if one exists. Otherwise, search for the
|
// representing the south pole, if one exists. Otherwise, search for the
|
||||||
// face containing this pole.
|
// face containing this pole.
|
||||||
if (m_south_pole != nullptr) return CGAL::make_object(m_south_pole);
|
if (m_south_pole != nullptr) return Result(m_south_pole);
|
||||||
it = m_boundary_vertices.begin();
|
it = m_boundary_vertices.begin();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
@ -625,7 +635,7 @@ locate_curve_end(const X_monotone_curve_2& xc, Arr_curve_end ind,
|
||||||
it = m_boundary_vertices.find(key);
|
it = m_boundary_vertices.find(key);
|
||||||
if (it != m_boundary_vertices.end()) {
|
if (it != m_boundary_vertices.end()) {
|
||||||
v = it->second;
|
v = it->second;
|
||||||
return CGAL::make_object(v);
|
return Result(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
it = m_boundary_vertices.lower_bound(key);
|
it = m_boundary_vertices.lower_bound(key);
|
||||||
|
|
@ -635,11 +645,10 @@ locate_curve_end(const X_monotone_curve_2& xc, Arr_curve_end ind,
|
||||||
// discontinuity that is strictly above the curve end. If there is none,
|
// discontinuity that is strictly above the curve end. If there is none,
|
||||||
// we know the curve end is contained in the spherical face. Otherwise,
|
// we know the curve end is contained in the spherical face. Otherwise,
|
||||||
// we return the face that lies below the vertex v.
|
// we return the face that lies below the vertex v.
|
||||||
if (it == m_boundary_vertices.end())
|
if (it == m_boundary_vertices.end()) return Result(m_spherical_face);
|
||||||
return CGAL::make_object(m_spherical_face);
|
|
||||||
|
|
||||||
v = it->second;
|
v = it->second;
|
||||||
return CGAL::make_object(_face_below_vertex_on_discontinuity(v));
|
return Result(_face_below_vertex_on_discontinuity(v));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! \brief determines whether a given boundary vertex is redundant */
|
/*! \brief determines whether a given boundary vertex is redundant */
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial
|
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// Author(s) : Ron Wein <wein@post.tau.ac.il>
|
// Author(s): Ron Wein <wein@post.tau.ac.il>
|
||||||
// Efi Fogel <efif@post.tau.ac.il>
|
// Efi Fogel <efif@post.tau.ac.il>
|
||||||
|
|
||||||
#ifndef CGAL_ARR_UNB_PLANAR_TOPOLOGY_TRAITS_2_IMPL_H
|
#ifndef CGAL_ARR_UNB_PLANAR_TOPOLOGY_TRAITS_2_IMPL_H
|
||||||
|
|
@ -296,27 +296,31 @@ are_equal(const Vertex *v,
|
||||||
// represent the curve end along the face boundary.
|
// represent the curve end along the face boundary.
|
||||||
//
|
//
|
||||||
template <typename GeomTraits, typename Dcel_>
|
template <typename GeomTraits, typename Dcel_>
|
||||||
CGAL::Object
|
boost::optional
|
||||||
|
<boost::variant
|
||||||
|
<typename Arr_unb_planar_topology_traits_2<GeomTraits, Dcel_>::Vertex*,
|
||||||
|
typename Arr_unb_planar_topology_traits_2<GeomTraits, Dcel_>::Halfedge*> >
|
||||||
Arr_unb_planar_topology_traits_2<GeomTraits, Dcel_>::
|
Arr_unb_planar_topology_traits_2<GeomTraits, Dcel_>::
|
||||||
place_boundary_vertex(Face *f,
|
place_boundary_vertex(Face* f,
|
||||||
const X_monotone_curve_2& cv, Arr_curve_end ind,
|
const X_monotone_curve_2& cv, Arr_curve_end ind,
|
||||||
Arr_parameter_space ps_x, Arr_parameter_space ps_y)
|
Arr_parameter_space ps_x, Arr_parameter_space ps_y)
|
||||||
{
|
{
|
||||||
|
typedef boost::variant<Vertex*, Halfedge*> Non_optional_result;
|
||||||
|
typedef boost::optional<Non_optional_result> Result;
|
||||||
|
|
||||||
// Get a halfedge on the outer CCB of f and start traversing the CCB.
|
// Get a halfedge on the outer CCB of f and start traversing the CCB.
|
||||||
Halfedge *first = *(f->outer_ccbs_begin());
|
Halfedge* first = *(f->outer_ccbs_begin());
|
||||||
Halfedge *curr = first;
|
Halfedge* curr = first;
|
||||||
bool eq_source, eq_target;
|
bool eq_source, eq_target;
|
||||||
|
|
||||||
do
|
do {
|
||||||
{
|
|
||||||
// Note we consider only fictitious halfedges and check whether they
|
// Note we consider only fictitious halfedges and check whether they
|
||||||
// contain the relevant curve end.
|
// contain the relevant curve end.
|
||||||
if (curr->has_null_curve() &&
|
if (curr->has_null_curve() &&
|
||||||
_is_on_fictitious_edge (cv, ind, ps_x, ps_y, curr,
|
_is_on_fictitious_edge(cv, ind, ps_x, ps_y, curr, eq_source, eq_target))
|
||||||
eq_source, eq_target))
|
|
||||||
{
|
{
|
||||||
CGAL_assertion (! eq_source && ! eq_target);
|
CGAL_assertion(! eq_source && ! eq_target);
|
||||||
return (CGAL::make_object (curr));
|
return Result(curr);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move to the next halfegde along the CCB.
|
// Move to the next halfegde along the CCB.
|
||||||
|
|
@ -327,59 +331,58 @@ place_boundary_vertex(Face *f,
|
||||||
// If we reached here, we did not find a suitable halfegde, which should
|
// If we reached here, we did not find a suitable halfegde, which should
|
||||||
// never happen.
|
// never happen.
|
||||||
CGAL_error();
|
CGAL_error();
|
||||||
return CGAL::Object();
|
return boost::none;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Locate a DCEL feature that contains the given unbounded curve end.
|
// Locate a DCEL feature that contains the given unbounded curve end.
|
||||||
//
|
//
|
||||||
template <typename GeomTraits, typename Dcel_>
|
template <typename GeomTraits, typename Dcel_>
|
||||||
CGAL::Object Arr_unb_planar_topology_traits_2<GeomTraits, Dcel_>::
|
boost::variant
|
||||||
|
<typename Arr_unb_planar_topology_traits_2<GeomTraits, Dcel_>::Vertex*,
|
||||||
|
typename Arr_unb_planar_topology_traits_2<GeomTraits, Dcel_>::Halfedge*,
|
||||||
|
typename Arr_unb_planar_topology_traits_2<GeomTraits, Dcel_>::Face*>
|
||||||
|
Arr_unb_planar_topology_traits_2<GeomTraits, Dcel_>::
|
||||||
locate_curve_end (const X_monotone_curve_2& cv, Arr_curve_end ind,
|
locate_curve_end (const X_monotone_curve_2& cv, Arr_curve_end ind,
|
||||||
Arr_parameter_space ps_x, Arr_parameter_space ps_y)
|
Arr_parameter_space ps_x, Arr_parameter_space ps_y)
|
||||||
{
|
{
|
||||||
|
typedef boost::variant<Vertex*, Halfedge*, Face*> Result;
|
||||||
|
|
||||||
// Start traversing the inner CCB of the fictitious face and try to locate
|
// Start traversing the inner CCB of the fictitious face and try to locate
|
||||||
// a feature that contains the curve end.
|
// a feature that contains the curve end.
|
||||||
Halfedge *first = *(fict_face->inner_ccbs_begin());
|
Halfedge* first = *(fict_face->inner_ccbs_begin());
|
||||||
Halfedge *curr = first;
|
Halfedge* curr = first;
|
||||||
bool eq_source, eq_target;
|
bool eq_source, eq_target;
|
||||||
|
|
||||||
do
|
do {
|
||||||
{
|
if (_is_on_fictitious_edge(cv, ind, ps_x, ps_y, curr, eq_source, eq_target))
|
||||||
if (_is_on_fictitious_edge (cv, ind, ps_x, ps_y, curr,
|
|
||||||
eq_source, eq_target))
|
|
||||||
{
|
|
||||||
if (eq_source)
|
|
||||||
{
|
{
|
||||||
|
if (eq_source) {
|
||||||
// cv's end coincides with the source vertex of the current
|
// cv's end coincides with the source vertex of the current
|
||||||
// fictitious halfedge. This means that cv overlaps the curve that
|
// fictitious halfedge. This means that cv overlaps the curve that
|
||||||
// is associated with the only non-fictitious halfedge incident to
|
// is associated with the only non-fictitious halfedge incident to
|
||||||
// this vertex. We therefore return a pointer to this halfedge.
|
// this vertex. We therefore return a pointer to this halfedge.
|
||||||
Halfedge *he = curr->opposite()->next();
|
Halfedge* he = curr->opposite()->next();
|
||||||
|
CGAL_assertion(! he->has_null_curve());
|
||||||
CGAL_assertion (! he->has_null_curve());
|
return Result(he);
|
||||||
return (CGAL::make_object (he));
|
|
||||||
}
|
}
|
||||||
else if (eq_target)
|
else if (eq_target) {
|
||||||
{
|
|
||||||
// cv's end coincides with the target vertex of the current
|
// cv's end coincides with the target vertex of the current
|
||||||
// fictitious halfedge. This means that cv overlaps the curve that
|
// fictitious halfedge. This means that cv overlaps the curve that
|
||||||
// is associated with the only non-fictitious halfedge incident to
|
// is associated with the only non-fictitious halfedge incident to
|
||||||
// this vertex. We therefore return a pointer to this halfedge.
|
// this vertex. We therefore return a pointer to this halfedge.
|
||||||
Halfedge *he = curr->opposite()->prev();
|
Halfedge* he = curr->opposite()->prev();
|
||||||
|
CGAL_assertion(! he->has_null_curve());
|
||||||
CGAL_assertion (! he->has_null_curve());
|
return Result(he);
|
||||||
return (CGAL::make_object (he));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// The current ficitious edge contains cv's end in its interior.
|
// The current ficitious edge contains cv's end in its interior.
|
||||||
// Note we use curr's twin, whose incident face is a valid
|
// Note we use curr's twin, whose incident face is a valid
|
||||||
// unbounded face (whereas the incident face of curr is the fictitious
|
// unbounded face (whereas the incident face of curr is the fictitious
|
||||||
// face).
|
// face).
|
||||||
Face *uf = curr->opposite()->outer_ccb()->face();
|
Face* uf = curr->opposite()->outer_ccb()->face();
|
||||||
|
|
||||||
CGAL_assertion (uf->is_unbounded() && ! uf->is_fictitious());
|
CGAL_assertion (uf->is_unbounded() && ! uf->is_fictitious());
|
||||||
return (CGAL::make_object (uf));
|
return Result(uf);
|
||||||
}
|
}
|
||||||
|
|
||||||
curr = curr->next();
|
curr = curr->next();
|
||||||
|
|
@ -388,7 +391,8 @@ locate_curve_end (const X_monotone_curve_2& cv, Arr_curve_end ind,
|
||||||
|
|
||||||
// We should never reach here.
|
// We should never reach here.
|
||||||
CGAL_error();
|
CGAL_error();
|
||||||
return Object();
|
Vertex* v(nullptr);
|
||||||
|
return Result(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,7 @@
|
||||||
// $Id$
|
// $Id$
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial
|
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial
|
||||||
//
|
//
|
||||||
//
|
// Author(s): Ron Wein <wein@post.tau.ac.il>
|
||||||
// Author(s) : Ron Wein <wein@post.tau.ac.il>
|
|
||||||
// Efi Fogel <efif@post.tau.ac.il>
|
// Efi Fogel <efif@post.tau.ac.il>
|
||||||
|
|
||||||
#ifndef CGAL_ARR_UNB_PLANAR_TOPOLOGY_TRAITS_2_H
|
#ifndef CGAL_ARR_UNB_PLANAR_TOPOLOGY_TRAITS_2_H
|
||||||
|
|
@ -308,7 +307,8 @@ public:
|
||||||
* \return An object that contains the curve end.
|
* \return An object that contains the curve end.
|
||||||
* In our case this object always wraps a fictitious edge.
|
* In our case this object always wraps a fictitious edge.
|
||||||
*/
|
*/
|
||||||
CGAL::Object place_boundary_vertex(Face* f,
|
boost::optional<boost::variant<Vertex*, Halfedge*> >
|
||||||
|
place_boundary_vertex(Face* f,
|
||||||
const X_monotone_curve_2& cv,
|
const X_monotone_curve_2& cv,
|
||||||
Arr_curve_end ind,
|
Arr_curve_end ind,
|
||||||
Arr_parameter_space ps_x,
|
Arr_parameter_space ps_x,
|
||||||
|
|
@ -346,7 +346,8 @@ public:
|
||||||
* In our case this object may either wrap an unbounded face,
|
* In our case this object may either wrap an unbounded face,
|
||||||
* or an edge with an end-vertex at infinity (in case of an overlap).
|
* or an edge with an end-vertex at infinity (in case of an overlap).
|
||||||
*/
|
*/
|
||||||
CGAL::Object locate_curve_end(const X_monotone_curve_2& cv,
|
boost::variant<Vertex*, Halfedge*, Face*>
|
||||||
|
locate_curve_end(const X_monotone_curve_2& cv,
|
||||||
Arr_curve_end ind,
|
Arr_curve_end ind,
|
||||||
Arr_parameter_space ps_x,
|
Arr_parameter_space ps_x,
|
||||||
Arr_parameter_space ps_y);
|
Arr_parameter_space ps_y);
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,7 @@
|
||||||
// $Id$
|
// $Id$
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial
|
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial
|
||||||
//
|
//
|
||||||
//
|
// Author(s): Ron Wein <wein@post.tau.ac.il>
|
||||||
// Author(s) : Ron Wein <wein@post.tau.ac.il>
|
|
||||||
// Efi Fogel <efif@post.tau.ac.il>
|
// Efi Fogel <efif@post.tau.ac.il>
|
||||||
// Eric Berberich <eric.berberich@cgal.org>
|
// Eric Berberich <eric.berberich@cgal.org>
|
||||||
// (based on old version by: Iddo Hanniel,
|
// (based on old version by: Iddo Hanniel,
|
||||||
|
|
@ -32,6 +31,8 @@
|
||||||
* class-template.
|
* class-template.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <boost/variant.hpp>
|
||||||
|
|
||||||
#include <CGAL/function_objects.h>
|
#include <CGAL/function_objects.h>
|
||||||
#include <CGAL/use.h>
|
#include <CGAL/use.h>
|
||||||
|
|
||||||
|
|
@ -2193,18 +2194,34 @@ _place_and_set_curve_end(DFace* f,
|
||||||
Arr_parameter_space ps_x, Arr_parameter_space ps_y,
|
Arr_parameter_space ps_x, Arr_parameter_space ps_y,
|
||||||
DHalfedge** p_pred)
|
DHalfedge** p_pred)
|
||||||
{
|
{
|
||||||
|
typedef boost::variant<DVertex*, DHalfedge*> Non_optional_result;
|
||||||
|
typedef boost::optional<Non_optional_result> Result;
|
||||||
// Use the topology traits to locate the DCEL feature that contains the
|
// Use the topology traits to locate the DCEL feature that contains the
|
||||||
// given curve end.
|
// given curve end.
|
||||||
CGAL::Object obj =
|
auto obj = m_topol_traits.place_boundary_vertex(f, cv, ind, ps_x, ps_y);
|
||||||
m_topol_traits.place_boundary_vertex(f, cv, ind, ps_x, ps_y);
|
|
||||||
DVertex* v;
|
|
||||||
DHalfedge* fict_he;
|
|
||||||
|
|
||||||
// Act according to the result type.
|
// Act according to the result type.
|
||||||
if (CGAL::assign(fict_he, obj)) {
|
|
||||||
|
if (! obj) {
|
||||||
|
// We have to create a new vertex that reprsents the given curve end.
|
||||||
|
DVertex* v = _create_boundary_vertex(cv, ind, ps_x, ps_y);
|
||||||
|
|
||||||
|
// Notify the topology traits on the creation of the boundary vertex.
|
||||||
|
m_topol_traits.notify_on_boundary_vertex_creation(v, cv, ind, ps_x, ps_y);
|
||||||
|
|
||||||
|
// There are no edges incident to v, therefore no predecessor halfedge.
|
||||||
|
*p_pred = nullptr;
|
||||||
|
|
||||||
|
// Return the vertex that represents the curve end.
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
|
DHalfedge** fict_he_p = boost::get<DHalfedge*>(&*obj);
|
||||||
|
if (fict_he_p != nullptr) {
|
||||||
|
DHalfedge* fict_he = *fict_he_p;
|
||||||
|
CGAL_assertion(fict_he != nullptr);
|
||||||
// The curve end is located on a fictitious edge. We first create a new
|
// The curve end is located on a fictitious edge. We first create a new
|
||||||
// vertex that corresponds to the curve end.
|
// vertex that corresponds to the curve end.
|
||||||
v = _create_boundary_vertex(cv, ind, ps_x, ps_y);
|
DVertex* v = _create_boundary_vertex(cv, ind, ps_x, ps_y);
|
||||||
|
|
||||||
// Split the fictitious halfedge at the newly created vertex.
|
// Split the fictitious halfedge at the newly created vertex.
|
||||||
// The returned halfedge is the predecessor for the insertion of the curve
|
// The returned halfedge is the predecessor for the insertion of the curve
|
||||||
|
|
@ -2216,29 +2233,16 @@ _place_and_set_curve_end(DFace* f,
|
||||||
|
|
||||||
_notify_after_split_fictitious_edge(Halfedge_handle(*p_pred),
|
_notify_after_split_fictitious_edge(Halfedge_handle(*p_pred),
|
||||||
Halfedge_handle((*p_pred)->next()));
|
Halfedge_handle((*p_pred)->next()));
|
||||||
|
return v;
|
||||||
}
|
}
|
||||||
else if (CGAL::assign(v, obj)) {
|
DVertex** v_p = boost::get<DVertex*>(&*obj);
|
||||||
|
CGAL_assertion(v_p != nullptr);
|
||||||
|
DVertex* v = *v_p;
|
||||||
|
CGAL_assertion(v != nullptr);
|
||||||
// In this case we are given an existing vertex that represents the curve
|
// In this case we are given an existing vertex that represents the curve
|
||||||
// end. We now have to locate the predecessor edge for the insertion of cv
|
// end. We now have to locate the predecessor edge for the insertion of cv
|
||||||
// around this vertex.
|
// around this vertex.
|
||||||
*p_pred =
|
*p_pred = m_topol_traits.locate_around_boundary_vertex(v, cv, ind, ps_x, ps_y);
|
||||||
m_topol_traits.locate_around_boundary_vertex(v, cv, ind, ps_x, ps_y);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
CGAL_assertion(obj.is_empty());
|
|
||||||
|
|
||||||
// In this case we have to create a new vertex that reprsents the given
|
|
||||||
// curve end.
|
|
||||||
v = _create_boundary_vertex(cv, ind, ps_x, ps_y);
|
|
||||||
|
|
||||||
// Notify the topology traits on the creation of the boundary vertex.
|
|
||||||
m_topol_traits.notify_on_boundary_vertex_creation(v, cv, ind, ps_x, ps_y);
|
|
||||||
|
|
||||||
// There are no edges incident to v, therefore no predecessor halfedge.
|
|
||||||
*p_pred = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Return the vertex that represents the curve end.
|
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -95,9 +95,8 @@ void Arrangement_zone_2<Arrangement, ZoneVisitor>::compute_zone()
|
||||||
// curve (currently m_obj stores the object containing it).
|
// curve (currently m_obj stores the object containing it).
|
||||||
const Vertex_const_handle* vh;
|
const Vertex_const_handle* vh;
|
||||||
const Halfedge_const_handle* hh;
|
const Halfedge_const_handle* hh;
|
||||||
const Face_const_handle* fh;
|
|
||||||
|
|
||||||
if ((vh = object_cast<Vertex_const_handle>(&m_obj)) != nullptr) {
|
if ((vh = boost::get<Vertex_const_handle>(&m_obj)) != nullptr) {
|
||||||
CGAL_assertion(m_has_left_pt);
|
CGAL_assertion(m_has_left_pt);
|
||||||
|
|
||||||
// The left endpoint coincides with an existing vertex:
|
// The left endpoint coincides with an existing vertex:
|
||||||
|
|
@ -119,7 +118,7 @@ void Arrangement_zone_2<Arrangement, ZoneVisitor>::compute_zone()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
else if ((hh = object_cast<Halfedge_const_handle>(&m_obj)) != nullptr) {
|
else if ((hh = boost::get<Halfedge_const_handle>(&m_obj)) != nullptr) {
|
||||||
if (m_has_left_pt) {
|
if (m_has_left_pt) {
|
||||||
// Obtain the right halfedge from the halfedge-pair containing m_left_pt
|
// Obtain the right halfedge from the halfedge-pair containing m_left_pt
|
||||||
// in their interior.
|
// in their interior.
|
||||||
|
|
@ -160,7 +159,7 @@ void Arrangement_zone_2<Arrangement, ZoneVisitor>::compute_zone()
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// The left endpoint lies inside a face.
|
// The left endpoint lies inside a face.
|
||||||
fh = object_cast<Face_const_handle>(&m_obj);
|
const Face_const_handle* fh = boost::get<Face_const_handle>(&m_obj);
|
||||||
|
|
||||||
CGAL_assertion_msg(fh != nullptr,
|
CGAL_assertion_msg(fh != nullptr,
|
||||||
"Invalid object returned by the point-location query.");
|
"Invalid object returned by the point-location query.");
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@
|
||||||
#include <CGAL/Arr_tags.h>
|
#include <CGAL/Arr_tags.h>
|
||||||
#include <CGAL/Arr_accessor.h>
|
#include <CGAL/Arr_accessor.h>
|
||||||
#include <CGAL/Arrangement_2/Arr_traits_adaptor_2.h>
|
#include <CGAL/Arrangement_2/Arr_traits_adaptor_2.h>
|
||||||
|
#include <CGAL/Arr_point_location_result.h>
|
||||||
|
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
@ -113,6 +114,9 @@ protected:
|
||||||
typedef std::set<const X_monotone_curve_2*> Curves_set;
|
typedef std::set<const X_monotone_curve_2*> Curves_set;
|
||||||
typedef typename Curves_set::iterator Curves_set_iterator;
|
typedef typename Curves_set::iterator Curves_set_iterator;
|
||||||
|
|
||||||
|
typedef Arr_point_location_result<Arrangement_2> Pl_result;
|
||||||
|
typedef typename Pl_result::Type Pl_result_type;
|
||||||
|
|
||||||
// Data members:
|
// Data members:
|
||||||
Arrangement_2& m_arr; // The associated arrangement.
|
Arrangement_2& m_arr; // The associated arrangement.
|
||||||
const Traits_adaptor_2* m_geom_traits; // Its associated geometry traits.
|
const Traits_adaptor_2* m_geom_traits; // Its associated geometry traits.
|
||||||
|
|
@ -127,7 +131,7 @@ protected:
|
||||||
|
|
||||||
X_monotone_curve_2 m_cv; // The current portion of the
|
X_monotone_curve_2 m_cv; // The current portion of the
|
||||||
// inserted curve.
|
// inserted curve.
|
||||||
CGAL::Object m_obj; // The location of the left endpoint.
|
Pl_result_type m_obj; // The location of the left endpoint.
|
||||||
bool m_has_left_pt; // Is the left end of the curve bounded.
|
bool m_has_left_pt; // Is the left end of the curve bounded.
|
||||||
bool m_left_on_boundary; // Is the left point on the boundary.
|
bool m_left_on_boundary; // Is the left point on the boundary.
|
||||||
Point_2 m_left_pt; // Its current left endpoint.
|
Point_2 m_left_pt; // Its current left endpoint.
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial
|
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// Author(s) : Baruch Zukerman <baruchzu@post.tau.ac.il>
|
// Author(s): Baruch Zukerman <baruchzu@post.tau.ac.il>
|
||||||
// Ron Wein <wein@post.tau.ac.il>
|
// Ron Wein <wein@post.tau.ac.il>
|
||||||
// Efi Fogel <efif@post.tau.ac.il>
|
// Efi Fogel <efif@post.tau.ac.il>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue