mirror of https://github.com/CGAL/cgal
removed infinity/unbounded - replaced by open boundary
This commit is contained in:
parent
f27d769be3
commit
b1829a3342
|
|
@ -1,12 +1,9 @@
|
|||
Rename:
|
||||
=======
|
||||
|
||||
Sweep_line + Event: Rename "initialize_at_inf" + CHECK is_finite???
|
||||
|
||||
Arrangement_on_surface_2.h + Arrangement_2/Arrangement_on_surface_2_impl.h + others: is_at_infinity() -> is_at_open_boundary()
|
||||
|
||||
|
||||
|
||||
Probably best idea: Use TopologyTraits (ARR_OPEN_BOUNDARY) + Parameter_space_in_x/y_2(cv, ind) to replace Is_closed_2
|
||||
|
||||
Tags:
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ after_handle_event (Event* event)
|
|||
// If the event is at infinity and occurs on the top edge of the fictitious
|
||||
// face (namely x is finite and y = +oo), we have to update the fictitious
|
||||
// edge we keep.
|
||||
if (event->is_finite())
|
||||
if (event->is_closed())
|
||||
return;
|
||||
|
||||
if (event->parameter_space_in_x() != ARR_INTERIOR)
|
||||
|
|
|
|||
|
|
@ -236,7 +236,7 @@ template <class Tr, class Arr, class Evnt, class Sbcv>
|
|||
void Arr_unb_planar_construction_helper<Tr,Arr,Evnt,Sbcv>::
|
||||
before_handle_event (Event* event)
|
||||
{
|
||||
if (event->is_finite())
|
||||
if (event->is_closed())
|
||||
return;
|
||||
|
||||
// As the event lieas at infinity, it must have only one (right or left)
|
||||
|
|
|
|||
|
|
@ -174,7 +174,7 @@ template <class Tr, class Arr, class Evnt, class Sbcv>
|
|||
void Arr_unb_planar_insertion_helper<Tr,Arr,Evnt,Sbcv>::
|
||||
before_handle_event (Event* event)
|
||||
{
|
||||
if (event->is_finite())
|
||||
if (event->is_closed())
|
||||
return;
|
||||
|
||||
// In case the event lies at inifinity, check whether its incident curve
|
||||
|
|
|
|||
|
|
@ -170,8 +170,8 @@ template <class Tr, class ArrR, class ArrB, class Arr, class Evnt, class Sbcv>
|
|||
void Arr_unb_planar_overlay_helper<Tr,ArrR,ArrB,Arr,Evnt,Sbcv>::
|
||||
before_handle_event (Event* e)
|
||||
{
|
||||
// Nothing to do in case the event represents a finite point.
|
||||
if (e->is_finite())
|
||||
// Nothing to do in case the event represents a valid point.
|
||||
if (e->is_closed())
|
||||
return;
|
||||
|
||||
// In case the event occurs on the left edge of the fictitious face (x = -oo)
|
||||
|
|
|
|||
|
|
@ -160,7 +160,7 @@ after_handle_event (Event* event)
|
|||
// If the event is at infinity and occurs on the top edge of the fictitious
|
||||
// face (namely x is finite and y = +oo), we have to update the fictitious
|
||||
// halfedges we keep.
|
||||
if (event->is_finite())
|
||||
if (event->is_closed())
|
||||
return;
|
||||
|
||||
if (event->parameter_space_in_x() != ARR_INTERIOR)
|
||||
|
|
|
|||
|
|
@ -469,8 +469,8 @@ protected:
|
|||
* Allocate an event object associated with a given point.
|
||||
* \param pt The point.
|
||||
* \param type The event type.
|
||||
* \param ps_x The boundary condition of the point in x.
|
||||
* \param ps_y The boundary condition of the point in y.
|
||||
* \param ps_x The location of the point in x.
|
||||
* \param ps_y The location of the point in y.
|
||||
* \pre Neither one of the boundary conditions is +/-oo.
|
||||
* \return The created event.
|
||||
*/
|
||||
|
|
@ -478,23 +478,24 @@ protected:
|
|||
Arr_parameter_space ps_x, Arr_parameter_space ps_y);
|
||||
|
||||
/*!
|
||||
* Allocate an event at infinity, which is not associated with a valid point.
|
||||
* Allocate an event at open boundary,
|
||||
* which is not associated with a valid point.
|
||||
* \param type The event type.
|
||||
* \param ps_x The boundary condition of the point in x.
|
||||
* \param ps_y The boundary condition of the point in y.
|
||||
* \param ps_x The location of the point in x.
|
||||
* \param ps_y The location of the point in y.
|
||||
* \param At least one of the boundary conditions is +/-oo.
|
||||
* \return The created event.
|
||||
*/
|
||||
Event* _allocate_event_at_infinity (Attribute type,
|
||||
Arr_parameter_space ps_x,
|
||||
Arr_parameter_space ps_y);
|
||||
Event* _allocate_event_at_open_boundary (Attribute type,
|
||||
Arr_parameter_space ps_x,
|
||||
Arr_parameter_space ps_y);
|
||||
|
||||
/*!
|
||||
* Push a finite event point into the event queue.
|
||||
* \param pt The point associated with the event.
|
||||
* \param type The event type.
|
||||
* \param ps_x The boundary condition of the point in x.
|
||||
* \param ps_y The boundary condition of the point in y.
|
||||
* \param ps_x The location of the point in x.
|
||||
* \param ps_y The location of the point in y.
|
||||
* \param sc A subcurve that the new event represents on of its endpoints.
|
||||
* \return A pair that comprises a pointer to the event, and a flag
|
||||
* indicating whether this is a new event (if false, the event
|
||||
|
|
@ -511,8 +512,8 @@ protected:
|
|||
* \param cv The x-monotone curve.
|
||||
* \param ind The relevant curve end.
|
||||
* \param type The event type.
|
||||
* \param ps_x The boundary condition of the point in x.
|
||||
* \param ps_y The boundary condition of the point in y.
|
||||
* \param ps_x The location of the point in x.
|
||||
* \param ps_y The location of the point in y.
|
||||
* \param sc A subcurve that the new event represents on of its endpoints.
|
||||
* \return A pair that comprises a pointer to the event, and a flag
|
||||
* indicating whether this is a new event (if false, the event
|
||||
|
|
@ -525,28 +526,28 @@ protected:
|
|||
Arr_parameter_space ps_y,
|
||||
Subcurve* sc = NULL);
|
||||
|
||||
void _update_event_at_infinity(Event* e,
|
||||
const X_monotone_curve_2& cv,
|
||||
Arr_curve_end ind,
|
||||
bool is_new)
|
||||
void _update_event_at_open_boundary(Event* e,
|
||||
const X_monotone_curve_2& cv,
|
||||
Arr_curve_end ind,
|
||||
bool is_new)
|
||||
{
|
||||
_update_event_at_infinity(e, cv, ind, is_new, Boundary_category());
|
||||
_update_event_at_open_boundary(e, cv, ind, is_new, Boundary_category());
|
||||
}
|
||||
|
||||
void _update_event_at_infinity(Event* e,
|
||||
const X_monotone_curve_2& cv,
|
||||
Arr_curve_end ind,
|
||||
bool is_new,
|
||||
Arr_has_boundary_tag)
|
||||
void _update_event_at_open_boundary(Event* e,
|
||||
const X_monotone_curve_2& cv,
|
||||
Arr_curve_end ind,
|
||||
bool is_new,
|
||||
Arr_has_boundary_tag)
|
||||
{
|
||||
m_visitor->update_event (e, cv, ind, is_new);
|
||||
}
|
||||
|
||||
void _update_event_at_infinity(Event* /* e */,
|
||||
const X_monotone_curve_2& /* cv */,
|
||||
Arr_curve_end /* ind */,
|
||||
bool /* is_new */,
|
||||
Arr_no_boundary_tag)
|
||||
void _update_event_at_open_boundary(Event* /* e */,
|
||||
const X_monotone_curve_2& /* cv */,
|
||||
Arr_curve_end /* ind */,
|
||||
bool /* is_new */,
|
||||
Arr_no_boundary_tag)
|
||||
{
|
||||
CGAL_error();
|
||||
}
|
||||
|
|
@ -555,7 +556,7 @@ protected:
|
|||
void PrintEventQueue();
|
||||
void PrintSubCurves();
|
||||
void PrintStatusLine();
|
||||
void PrintInfinityType(Arr_parameter_space x, Arr_parameter_space y);
|
||||
void PrintOpenBoundaryType(Arr_parameter_space x, Arr_parameter_space y);
|
||||
void PrintEvent(const Event* e);
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -428,7 +428,7 @@ add_subcurve (const X_monotone_curve_2& cv, Subcurve* sc)
|
|||
const Halfedge_handle invalid_he;
|
||||
|
||||
#if CGAL_ARR_CONSTRUCTION_SL_VISITOR_VERBOSE
|
||||
if (last_event->is_finite()) {
|
||||
if (last_event->is_closed()) {
|
||||
std::cout << "CGAL_CSLG lastevent: " << last_event->point() << std::endl;
|
||||
}
|
||||
if (he_left != invalid_he) {
|
||||
|
|
|
|||
|
|
@ -384,7 +384,7 @@ update_event (Event *e,
|
|||
bool /* is_new */)
|
||||
{
|
||||
// Nothing to do in case of an event at infinity.
|
||||
CGAL_assertion(e->is_finite());
|
||||
CGAL_assertion(e->is_closed());
|
||||
|
||||
// Update the red and blue objects associated with the point as necessary.
|
||||
Point_2& pt = e->point();
|
||||
|
|
|
|||
|
|
@ -142,8 +142,8 @@ bool Arr_vert_decomp_sl_visitor<Hlpr, OutIt>::after_handle_event
|
|||
// Notify the helper on the event.
|
||||
m_helper.after_handle_event (event);
|
||||
|
||||
// We are only interested in events associated with finite points:
|
||||
if (! event->is_finite())
|
||||
// We are only interested in events associated with valid points:
|
||||
if (! event->is_closed())
|
||||
return (true);
|
||||
|
||||
// Get the vertex handle associated with the current event (stored with
|
||||
|
|
|
|||
|
|
@ -313,19 +313,19 @@ _init_curve_end(const X_monotone_curve_2& cv, Arr_curve_end ind, Subcurve* sc)
|
|||
// Inform the visitor in case we updated an existing event.
|
||||
Event *e = pair_res.first;
|
||||
|
||||
CGAL_assertion (e->is_finite());
|
||||
CGAL_assertion (e->is_closed());
|
||||
m_visitor->update_event (e, pt, cv, ind, pair_res.second);
|
||||
}
|
||||
else
|
||||
{
|
||||
// The curve end is unbounded, insert it into the event queue.
|
||||
// The curve end is open, insert it into the event queue.
|
||||
pair_res = _push_event (cv, ind, end_attr, ps_x, ps_y, sc);
|
||||
|
||||
// Inform the visitor in case we updated an existing event.
|
||||
Event *e = pair_res.first;
|
||||
|
||||
CGAL_assertion (! e->is_finite());
|
||||
_update_event_at_infinity(e, cv, ind, pair_res.second);
|
||||
CGAL_assertion (! e->is_closed());
|
||||
_update_event_at_open_boundary(e, cv, ind, pair_res.second);
|
||||
}
|
||||
|
||||
return;
|
||||
|
|
@ -349,7 +349,7 @@ void Basic_sweep_line_2<Tr, Vis, Subcv, Evnt, Alloc>::_handle_left_curves()
|
|||
// We also notify the visitor on the new event we are about to handle.
|
||||
_handle_event_without_left_curves();
|
||||
|
||||
if (m_currentEvent->is_finite())
|
||||
if (m_currentEvent->is_closed())
|
||||
{
|
||||
if (m_is_event_on_above)
|
||||
{
|
||||
|
|
@ -640,24 +640,26 @@ _allocate_event (const Point_2& pt, Attribute type,
|
|||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Allocate an event at infinity, which is not associated with a valid point.
|
||||
// Allocate an event at open boundary,
|
||||
// which is not associated with a valid point.
|
||||
//
|
||||
template <class Tr, class Vis, class Subcv, class Evnt, typename Alloc>
|
||||
typename Basic_sweep_line_2<Tr, Vis, Subcv, Evnt, Alloc>::Event*
|
||||
Basic_sweep_line_2<Tr, Vis, Subcv, Evnt, Alloc>::
|
||||
_allocate_event_at_infinity(Attribute type,
|
||||
Arr_parameter_space ps_x, Arr_parameter_space ps_y)
|
||||
_allocate_event_at_open_boundary(Attribute type,
|
||||
Arr_parameter_space ps_x,
|
||||
Arr_parameter_space ps_y)
|
||||
{
|
||||
Event *e = m_eventAlloc.allocate(1);
|
||||
m_eventAlloc.construct(e, m_masterEvent);
|
||||
e->init_at_infinity (type, ps_x, ps_y);
|
||||
e->init_at_open_boundary (type, ps_x, ps_y);
|
||||
|
||||
m_allocated_events.insert(e);
|
||||
return (e);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Push a finite event point into the event queue.
|
||||
// Push a closed event point into the event queue.
|
||||
//
|
||||
template <class Tr, class Vis, class Subcv, class Evnt, typename Alloc>
|
||||
std::pair<typename Basic_sweep_line_2<Tr, Vis, Subcv, Evnt, Alloc>::Event*,
|
||||
|
|
@ -686,7 +688,7 @@ _push_event (const Point_2& pt, Attribute type,
|
|||
// The event associated with the given point already exists in the queue,
|
||||
// so we just have to update it.
|
||||
e = *(pair_res.first);
|
||||
CGAL_assertion (e->is_finite());
|
||||
CGAL_assertion (e->is_closed());
|
||||
|
||||
e->set_attribute(type);
|
||||
}
|
||||
|
|
@ -765,8 +767,8 @@ _push_event (const X_monotone_curve_2& cv, Arr_curve_end ind,
|
|||
}
|
||||
else
|
||||
{
|
||||
// The curve end is unbounded, so we create an event at infinity.
|
||||
e = _allocate_event_at_infinity (type, ps_x, ps_y);
|
||||
// The curve end is open, so we create an event at open boundary.
|
||||
e = _allocate_event_at_open_boundary (type, ps_x, ps_y);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -64,14 +64,14 @@ void Basic_sweep_line_2<Tr, Visit, Crv, Evnt, Alloc>::PrintStatusLine()
|
|||
return;
|
||||
}
|
||||
std::cout << std::endl << "Status line: (" ;
|
||||
if(m_currentEvent->is_finite())
|
||||
if(m_currentEvent->is_closed())
|
||||
std::cout << m_currentEvent->point() << ")" << std::endl;
|
||||
else
|
||||
{
|
||||
Arr_parameter_space x = m_currentEvent->parameter_space_in_x(),
|
||||
y = m_currentEvent->parameter_space_in_y();
|
||||
|
||||
PrintInfinityType(x, y);
|
||||
PrintOpenBoundaryType(x, y);
|
||||
}
|
||||
Status_line_iterator iter = m_statusLine.begin();
|
||||
while ( iter != m_statusLine.end() )
|
||||
|
|
@ -84,7 +84,7 @@ void Basic_sweep_line_2<Tr, Visit, Crv, Evnt, Alloc>::PrintStatusLine()
|
|||
|
||||
template <class Tr, class Visit, class Crv, class Evnt, class Alloc>
|
||||
void Basic_sweep_line_2<Tr, Visit, Crv, Evnt, Alloc>::
|
||||
PrintInfinityType (Arr_parameter_space ps_x, Arr_parameter_space ps_y)
|
||||
PrintOpenBoundaryType (Arr_parameter_space ps_x, Arr_parameter_space ps_y)
|
||||
{
|
||||
switch (ps_x) {
|
||||
case ARR_LEFT_BOUNDARY: std::cout << "left boundary"; return;
|
||||
|
|
@ -105,14 +105,14 @@ template <class Tr, class Visit, class Crv, class Evnt, class Alloc>
|
|||
void Basic_sweep_line_2<Tr, Visit, Crv, Evnt, Alloc>::
|
||||
PrintEvent(const Event* e)
|
||||
{
|
||||
if (e->is_finite())
|
||||
if (e->is_closed())
|
||||
std::cout << e->point();
|
||||
else
|
||||
{
|
||||
Arr_parameter_space x = e->parameter_space_in_x();
|
||||
Arr_parameter_space y = e->parameter_space_in_y();
|
||||
PrintInfinityType(x, y);
|
||||
std::cout << " with unbounded curve: " << e->curve();
|
||||
PrintOpenBoundaryType(x, y);
|
||||
std::cout << " with open curve: " << e->curve();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ public:
|
|||
{
|
||||
if ((m_includeEndPoints ||
|
||||
event->is_intersection() ||
|
||||
event->is_weak_intersection()) && event->is_finite())
|
||||
event->is_weak_intersection()) && event->is_closed())
|
||||
{
|
||||
*m_out = event->point();
|
||||
++m_out;
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ protected:
|
|||
char m_type; // The event type.
|
||||
char m_ps_x; // The boundary condition in x.
|
||||
char m_ps_y; // The boundary condition in y.
|
||||
char m_finite; // Is the event finite (associated with
|
||||
char m_closed; // Is the event closed (associated with
|
||||
// a valid point.
|
||||
|
||||
public:
|
||||
|
|
@ -105,7 +105,7 @@ public:
|
|||
m_type (0),
|
||||
m_ps_x (static_cast<char> (ARR_INTERIOR)),
|
||||
m_ps_y (static_cast<char> (ARR_INTERIOR)),
|
||||
m_finite (1)
|
||||
m_closed (1)
|
||||
{}
|
||||
|
||||
/*! Initialize an event that is associated with a valid point. */
|
||||
|
|
@ -116,17 +116,18 @@ public:
|
|||
m_type = type;
|
||||
m_ps_x = static_cast<char> (ps_x);
|
||||
m_ps_y = static_cast<char> (ps_y);
|
||||
m_finite = 1;
|
||||
m_closed = 1;
|
||||
}
|
||||
|
||||
/*! Initialize an event associates with an unbounded curve end. */
|
||||
void init_at_infinity (Attribute type,
|
||||
Arr_parameter_space ps_x, Arr_parameter_space ps_y)
|
||||
/*! Initialize an event associates with an open curve end. */
|
||||
void init_at_open_boundary (Attribute type,
|
||||
Arr_parameter_space ps_x,
|
||||
Arr_parameter_space ps_y)
|
||||
{
|
||||
m_type = type;
|
||||
m_ps_x = ps_x;
|
||||
m_ps_y = ps_y;
|
||||
m_finite = 0;
|
||||
m_closed = 0;
|
||||
}
|
||||
|
||||
/*! Add a subcurve to the container of left curves. */
|
||||
|
|
@ -170,9 +171,11 @@ public:
|
|||
return (std::make_pair(false, m_rightCurves.begin()));
|
||||
}
|
||||
|
||||
// Check if its an event an infinity, and if so then there is no overlap
|
||||
//(there cannot be two non-overlap curves at the same event at infinity).
|
||||
if (!this->is_finite())
|
||||
// Check if its an event at open boundary,
|
||||
// and if so then there is no overlap
|
||||
//(there cannot be two non-overlap curves at the same event at open
|
||||
// boundary).
|
||||
if (!this->is_closed())
|
||||
return (std::make_pair(true, m_rightCurves.begin()));
|
||||
|
||||
Subcurve_iterator iter = m_rightCurves.begin();
|
||||
|
|
@ -311,21 +314,21 @@ public:
|
|||
|
||||
/*!
|
||||
* Get the actual event point (const version).
|
||||
* \pre The event is associated with a finite point.
|
||||
* \pre The event is associated with a valid point.
|
||||
*/
|
||||
const Point_2& point() const
|
||||
{
|
||||
CGAL_precondition (is_finite());
|
||||
CGAL_precondition (is_closed());
|
||||
return (m_point);
|
||||
}
|
||||
|
||||
/*!
|
||||
* Get the actual event point (non-const version).
|
||||
* \pre The event is associated with a finite point.
|
||||
* \pre The event is associated with a valid point.
|
||||
*/
|
||||
Point_2& point()
|
||||
{
|
||||
CGAL_precondition (is_finite());
|
||||
CGAL_precondition (is_closed());
|
||||
return (m_point);
|
||||
}
|
||||
|
||||
|
|
@ -431,9 +434,9 @@ public:
|
|||
|
||||
/// \name Get the boundary conditions of the event.
|
||||
//@{
|
||||
inline bool is_finite() const
|
||||
inline bool is_closed() const
|
||||
{
|
||||
return (m_finite != 0);
|
||||
return (m_closed != 0);
|
||||
}
|
||||
|
||||
inline bool is_on_boundary () const
|
||||
|
|
@ -530,7 +533,7 @@ public:
|
|||
void Sweep_line_event<Traits, Subcurve>::Print()
|
||||
{
|
||||
std::cout << "\tEvent info: " << "\n" ;
|
||||
if (this->is_finite())
|
||||
if (this->is_closed())
|
||||
std::cout << "\t" << m_point << "\n" ;
|
||||
else
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue