mirror of https://github.com/CGAL/cgal
replace Object
This commit is contained in:
parent
f669df07bf
commit
a1fb4c4814
|
|
@ -25,7 +25,6 @@ int main ()
|
||||||
Arr_with_hist_2 arr;
|
Arr_with_hist_2 arr;
|
||||||
Curve_2 C[9];
|
Curve_2 C[9];
|
||||||
Curve_handle handles[9];
|
Curve_handle handles[9];
|
||||||
int k;
|
|
||||||
|
|
||||||
C[0] = Circle_2(Rat_point_2(_7_halves, _7_halves), 4, CGAL::CLOCKWISE);
|
C[0] = Circle_2(Rat_point_2(_7_halves, _7_halves), 4, CGAL::CLOCKWISE);
|
||||||
C[1] = Circle_2(Rat_point_2(_7_halves, 6), 1, CGAL::CLOCKWISE);
|
C[1] = Circle_2(Rat_point_2(_7_halves, 6), 1, CGAL::CLOCKWISE);
|
||||||
|
|
@ -37,6 +36,7 @@ int main ()
|
||||||
C[7] = Circle_2(Rat_point_2(1, _7_halves), 1, CGAL::CLOCKWISE);
|
C[7] = Circle_2(Rat_point_2(1, _7_halves), 1, CGAL::CLOCKWISE);
|
||||||
C[8] = Circle_2(Rat_point_2(2, 5), 1, CGAL::CLOCKWISE);
|
C[8] = Circle_2(Rat_point_2(2, 5), 1, CGAL::CLOCKWISE);
|
||||||
|
|
||||||
|
unsigned int k;
|
||||||
for (k = 0; k < 9; k++)
|
for (k = 0; k < 9; k++)
|
||||||
handles[k] = insert(arr, C[k]);
|
handles[k] = insert(arr, C[k]);
|
||||||
|
|
||||||
|
|
@ -58,7 +58,7 @@ int main ()
|
||||||
// Locate the point q, which should be on an edge e.
|
// Locate the point q, which should be on an edge e.
|
||||||
Point_location pl(arr);
|
Point_location pl(arr);
|
||||||
const Point_2 q = Point_2(_7_halves, 7);
|
const Point_2 q = Point_2(_7_halves, 7);
|
||||||
CGAL::Object obj = pl.locate (q);
|
Point_location::result_type obj = pl.locate(q);
|
||||||
Arr_with_hist_2::Halfedge_const_handle e;
|
Arr_with_hist_2::Halfedge_const_handle e;
|
||||||
|
|
||||||
CGAL_assertion_code(bool success = ) CGAL::assign(e, obj);
|
CGAL_assertion_code(bool success = ) CGAL::assign(e, obj);
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ int main ()
|
||||||
// Perform a point-location query on the resulting arrangement and print
|
// Perform a point-location query on the resulting arrangement and print
|
||||||
// the boundary of the face that contains it.
|
// the boundary of the face that contains it.
|
||||||
Point_2 q(4, 1);
|
Point_2 q(4, 1);
|
||||||
CGAL::Object obj = pl.locate (q);
|
Walk_pl::result_type obj = pl.locate(q);
|
||||||
|
|
||||||
Arrangement_2::Face_const_handle f;
|
Arrangement_2::Face_const_handle f;
|
||||||
CGAL_assertion_code(bool success =) CGAL::assign(f, obj);
|
CGAL_assertion_code(bool success =) CGAL::assign(f, obj);
|
||||||
|
|
|
||||||
|
|
@ -2,12 +2,13 @@
|
||||||
// Perform a point-location query and print the result.
|
// Perform a point-location query and print the result.
|
||||||
//
|
//
|
||||||
template <class PointLocation>
|
template <class PointLocation>
|
||||||
void point_location_query
|
void
|
||||||
(const PointLocation& pl,
|
point_location_query(const PointLocation& pl,
|
||||||
const typename PointLocation::Arrangement_2::Point_2& q)
|
const typename PointLocation::Arrangement_2::Point_2& q)
|
||||||
{
|
{
|
||||||
|
typedef PointLocation Point_location;
|
||||||
// Perform the point-location query.
|
// Perform the point-location query.
|
||||||
CGAL::Object obj = pl.locate (q);
|
typename Point_location::result_type obj = pl.locate(q);
|
||||||
|
|
||||||
// Print the result.
|
// Print the result.
|
||||||
typedef typename PointLocation::Arrangement_2 Arrangement_2;
|
typedef typename PointLocation::Arrangement_2 Arrangement_2;
|
||||||
|
|
@ -18,34 +19,22 @@ void point_location_query
|
||||||
|
|
||||||
std::cout << "The point (" << q << ") is located ";
|
std::cout << "The point (" << q << ") is located ";
|
||||||
if (CGAL::assign(f, obj))
|
if (CGAL::assign(f, obj))
|
||||||
{
|
|
||||||
// q is located inside a face:
|
// q is located inside a face:
|
||||||
if (f->is_unbounded())
|
std::cout << ((f->is_unbounded()) ?
|
||||||
std::cout << "inside the unbounded face." << std::endl;
|
"inside the unbounded face." : "inside a bounded face.")
|
||||||
else
|
<< std::endl;
|
||||||
std::cout << "inside a bounded face." << std::endl;
|
|
||||||
}
|
|
||||||
else if (CGAL::assign(e, obj))
|
else if (CGAL::assign(e, obj))
|
||||||
{
|
|
||||||
// q is located on an edge:
|
// q is located on an edge:
|
||||||
std::cout << "on an edge: " << e->curve() << std::endl;
|
std::cout << "on an edge: " << e->curve() << std::endl;
|
||||||
}
|
|
||||||
else if (CGAL::assign(v, obj))
|
else if (CGAL::assign(v, obj))
|
||||||
{
|
|
||||||
// q is located on a vertex:
|
// q is located on a vertex:
|
||||||
if (v->is_isolated())
|
std::cout << ((v->is_isolated()) ?
|
||||||
std::cout << "on an isolated vertex: " << v->point() << std::endl;
|
"on an isolated vertex: " : "on a vertex: ")
|
||||||
|
<< v->point() << std::endl;
|
||||||
else
|
else
|
||||||
std::cout << "on a vertex: " << v->point() << std::endl;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
CGAL_error_msg( "Invalid object.");
|
CGAL_error_msg( "Invalid object.");
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Perform a vertical ray-shooting query and print the result.
|
// Perform a vertical ray-shooting query and print the result.
|
||||||
//
|
//
|
||||||
|
|
@ -54,8 +43,9 @@ void vertical_ray_shooting_query
|
||||||
(const VerticalRayShoot& vrs,
|
(const VerticalRayShoot& vrs,
|
||||||
const typename VerticalRayShoot::Arrangement_2::Point_2& q)
|
const typename VerticalRayShoot::Arrangement_2::Point_2& q)
|
||||||
{
|
{
|
||||||
|
typedef VerticalRayShoot Vertical_ray_shoot;
|
||||||
// Perform the point-location query.
|
// Perform the point-location query.
|
||||||
CGAL::Object obj = vrs.ray_shoot_up (q);
|
typename Vertical_ray_shoot::result_type obj = vrs.ray_shoot_up(q);
|
||||||
|
|
||||||
// Print the result.
|
// Print the result.
|
||||||
typedef typename VerticalRayShoot::Arrangement_2 Arrangement_2;
|
typedef typename VerticalRayShoot::Arrangement_2 Arrangement_2;
|
||||||
|
|
@ -66,33 +56,22 @@ void vertical_ray_shooting_query
|
||||||
|
|
||||||
std::cout << "Shooting up from (" << q << ") : ";
|
std::cout << "Shooting up from (" << q << ") : ";
|
||||||
if (CGAL::assign(e, obj))
|
if (CGAL::assign(e, obj))
|
||||||
{
|
|
||||||
// We hit an edge:
|
// We hit an edge:
|
||||||
std::cout << "hit an edge: " << e->curve() << std::endl;
|
std::cout << "hit an edge: " << e->curve() << std::endl;
|
||||||
}
|
|
||||||
else if (CGAL::assign(v, obj))
|
else if (CGAL::assign(v, obj))
|
||||||
{
|
|
||||||
// We hit a vertex:
|
// We hit a vertex:
|
||||||
if (v->is_isolated())
|
std::cout << ((v->is_isolated()) ?
|
||||||
std::cout << "hit an isolated vertex: " << v->point() << std::endl;
|
"hit an isolated vertex: " : "hit a vertex: ")
|
||||||
else
|
<< v->point() << std::endl;
|
||||||
std::cout << "hit a vertex: " << v->point() << std::endl;
|
else if (CGAL::assign(f, obj)) {
|
||||||
}
|
|
||||||
else if (CGAL::assign (f, obj))
|
|
||||||
{
|
|
||||||
// We did not hit anything:
|
// We did not hit anything:
|
||||||
CGAL_assertion(f->is_unbounded());
|
CGAL_assertion(f->is_unbounded());
|
||||||
|
|
||||||
std::cout << "hit nothing." << std::endl;
|
std::cout << "hit nothing." << std::endl;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
CGAL_error_msg( "Invalid object.");
|
CGAL_error_msg( "Invalid object.");
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Construct the arrangement of segments needed for the point-location and
|
// Construct the arrangement of segments needed for the point-location and
|
||||||
// the vertical ray-shooting examples.
|
// the vertical ray-shooting examples.
|
||||||
|
|
@ -116,6 +95,4 @@ void construct_segments_arr (Arrangement& arr)
|
||||||
Halfedge_handle e3 = arr.insert_from_left_vertex(s3, e2->target());
|
Halfedge_handle e3 = arr.insert_from_left_vertex(s3, e2->target());
|
||||||
Halfedge_handle e4 = arr.insert_from_right_vertex(s4, e3->target());
|
Halfedge_handle e4 = arr.insert_from_right_vertex(s4, e3->target());
|
||||||
Halfedge_handle e5 = arr.insert_at_vertices(s5, e4->target(), e1->source());
|
Halfedge_handle e5 = arr.insert_at_vertices(s5, e4->target(), e1->source());
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue