bug in zone in spherical topology

This commit is contained in:
Ophir Setter 2007-09-16 07:42:41 +00:00
parent a495d47d5b
commit 4327171fd8
3 changed files with 24 additions and 17 deletions

View File

@ -47,7 +47,7 @@
#include <CGAL/Arr_topology_traits/Arr_spherical_overlay_helper.h>
#include <CGAL/Arr_topology_traits/Arr_spherical_batched_pl_helper.h>
#include <CGAL/Arr_topology_traits/Arr_spherical_vert_decomp_helper.h>
#include <CGAL/Arr_topology_traits/Arr_spherical_inc_insertion_zone_visitor.h>
#include <CGAL/Arr_topology_traits/Arr_planar_inc_insertion_zone_visitor.h>
#include <map>
@ -402,9 +402,9 @@ public:
{}
};
typedef Arr_spherical_inc_insertion_zone_visitor<Arr>
typedef Arr_planar_inc_insertion_zone_visitor<Arr>
Zone_insertion_visitor;
typedef Arr_naive_point_location<Arr>
Default_point_location_strategy;
//@}

View File

@ -51,12 +51,14 @@ void Arrangement_zone_2<Arrangement,ZoneVisitor>::init_with_hint
{
// The left endpoint is valid.
has_left_pt = true;
left_on_boundary = (bx1 != NO_BOUNDARY || by1 != NO_BOUNDARY);
left_pt = geom_traits->construct_min_vertex_2_object() (cv);
}
else
{
// The left end of the curve lies at infinity.
has_left_pt = false;
left_on_boundary = true;
}
const Boundary_type bx2 = geom_traits->boundary_in_x_2_object()(cv,
@ -513,10 +515,10 @@ Arrangement_zone_2<Arrangement,ZoneVisitor>::_compute_next_intersection
// Compare that current object with left_pt (if exists).
ip = object_cast<Intersect_point_2> (&(inter_list.front()));
if (! has_left_pt)
if (left_on_boundary)
{
// The left end is unbounded, so all intersections are valid, as
// they lie to its right.
// The left end lie on the left boundary, so all intersections are
// valid, as they lie to its right.
valid_intersection = true;
}
else if (ip != NULL)
@ -585,20 +587,20 @@ Arrangement_zone_2<Arrangement,ZoneVisitor>::_compute_next_intersection
if (ip != NULL)
{
// We have a simple intersection point - if we don't have to skip it,
// make sure it lies to the right of left_pt (if left_pt does not
// exist, all points lie to it right).
// make sure it lies to the right of left_pt (if left_pt is on the left
// boundary, all points lie to it right).
if (is_first && skip_first_point)
valid_intersection = false;
else if (! has_left_pt)
else if (left_on_boundary)
valid_intersection = true;
else
valid_intersection =
(geom_traits->compare_xy_2_object() (ip->first, left_pt) == LARGER);
}
else if (! has_left_pt)
else if (left_on_boundary)
{
// The left end is unbounded, so all overlapping curves are valid, as
// they lie to its right.
// The left end is on the boundary, so all overlapping curves are valid,
// as they lie to its right.
valid_intersection = true;
}
else
@ -866,7 +868,7 @@ void Arrangement_zone_2<Arrangement,ZoneVisitor>::
// Check whether the two curves overlap in their x-range (in order
// to avoid unnecessary intersection computations).
if (! left_equals_curr_endpoint &&
((has_left_pt && _is_to_right (left_pt, he_curr)) ||
((! left_on_boundary && _is_to_right (left_pt, he_curr)) ||
! is_in_x_range (cv, he_curr->curve())))
{
// In case there is no overlap, the two x-monotone curves obviously
@ -1002,7 +1004,7 @@ void Arrangement_zone_2<Arrangement,ZoneVisitor>::
// Check whether the two curves overlap in their x-range (in order
// to avoid unnecessary intersection computations).
if (! left_equals_curr_endpoint &&
((has_left_pt && _is_to_right (left_pt, he_curr)) ||
((! left_on_boundary && _is_to_right (left_pt, he_curr)) ||
! is_in_x_range (cv, he_curr->curve())))
{
// In case there is no overlap, the two x-monotone curves obviously
@ -1172,6 +1174,7 @@ bool Arrangement_zone_2<Arrangement,ZoneVisitor>::_zone_in_face
// Set cv to be the remaining portion.
has_left_pt = true;
left_on_boundary = false;
left_pt = intersect_p;
cv = sub_cv2;
}
@ -1485,6 +1488,7 @@ bool Arrangement_zone_2<Arrangement,ZoneVisitor>::_zone_in_overlap ()
// Set cv to be the remaining portion.
has_left_pt = true;
left_on_boundary = false;
left_pt = cv_right_pt;
cv = sub_cv2;

View File

@ -105,6 +105,7 @@ protected:
CGAL::Object obj; // The location of the left endpoint.
bool has_left_pt; // Is the left end of the curve
// bounded.
bool left_on_boundary;// Is the left point on the boundary.
Point_2 left_pt; // Its current left endpoint.
bool has_right_pt; // Is the right end of the curve
// bounded.
@ -187,6 +188,7 @@ public:
{
// The curve has a finite left endpoint - locate it in the arrangement.
has_left_pt = true;
left_on_boundary = (bx1 != NO_BOUNDARY || by1 != NO_BOUNDARY);
left_pt = geom_traits->construct_min_vertex_2_object() (cv);
obj = pl.locate (left_pt);
@ -196,6 +198,7 @@ public:
// The left end of the curve is unbounded - use the topology traits use
// the arrangement accessor to locate it.
has_left_pt = false;
left_on_boundary = true;
obj = arr_access.locate_unbounded_curve_end (cv, MIN_END, bx1, by1);
}
@ -267,8 +270,8 @@ private:
*/
Halfedge_handle _direct_intersecting_edge_to_right
(const X_monotone_curve_2& cv_ins,
const Point_2& cv_left_pt,
Halfedge_handle query_he);
const Point_2& cv_left_pt,
Halfedge_handle query_he);
/*!
* Direct the halfedge for the location of the given subcurve around a split
@ -284,7 +287,7 @@ private:
*/
Halfedge_handle _direct_intersecting_edge_to_left
(const X_monotone_curve_2& cv_ins,
Halfedge_handle query_he);
Halfedge_handle query_he);
/*!
* Get the next intersection of cv with the given halfedge.