CGAL 6.0 - 2D Visibility
Loading...
Searching...
No Matches
Visibility_2 Concept Reference

Definition

A model of the Visibility_2 concept can be attached to an Arrangement_2 instance to answer visibility queries within the faces of this arrangement.

Has models
CGAL::Simple_polygon_visibility_2
CGAL::Rotational_sweep_visibility_2
CGAL::Triangular_expansion_visibility_2

Types

typedef unspecified_type Arrangement_2
 The arrangement type of the input.
 
typedef Arrangement_2::Point_2 Point_2
 The 2D point type used for the queries.
 
typedef Arrangement_2::Face_const_handle Face_const_handle
 The face handle type of the input arrangement.
 
typedef Arrangement_2::Halfedge_const_handle Halfedge_const_handle
 The halfedge handle type of the input arrangement.
 

Tags

typedef unspecified_type Regularization_category
 identifies whether the regularized visibility area is computed (either #Tag_true or #Tag_false).
 
typedef unspecified_type Supports_general_polygon_category
 identifies whether general polygons (with holes) are supported (either #Tag_true or #Tag_false).
 
typedef unspecified_type Supports_simple_polygon_category
 identifies whether simple polygons are supported (either #Tag_true or #Tag_false).
 

Constructors

 Visibility_2 ()
 Default constructor creates an empty Visibility_2 object that is not attached to any arrangement yet.
 
 Visibility_2 (const Arrangement_2 &arr)
 Constructs a Visibility_2 object that is attached to arr.
 

Functions

bool is_attached () const
 Returns whether an arrangement is attached to the visibility object.
 
void attach (const Arrangement_2 &arr)
 Attaches the given arrangement arr to the visibility object.
 
void detach ()
 Detaches the arrangement from the visibility object it is currently attached to.
 
const Arrangement_2arrangement_2 () const
 Access to the attached arrangement.
 
template<typename VisibilityArrangement_2 >
Visibility_arrangement_2::Face_handle compute_visibility (const Point_2 &q, const Face_const_handle f, VisibilityArrangement_2 &out_arr) const
 Computes the visibility region for the given query point q in the face \( f \) of the arrangement that is attached to the visibility object.
 
template<typename VisibilityArrangement_2 >
Visibility_arrangement_2::Face_handle compute_visibility (const Point_2 &q, const Halfedge_const_handle e, Visibility_arrangement_2 &out_arr) const
 Computes the visibility region in e->face() for the given query point q which must be located on e.
 

Member Typedef Documentation

◆ Supports_general_polygon_category

identifies whether general polygons (with holes) are supported (either #Tag_true or #Tag_false).

A general polygon is represented by a face \( f \) with no isolated vertex and any edge of \( f \) separates \( f \) from another face. Note that this allows \( f \) to touch a vertex from several sides.

◆ Supports_simple_polygon_category

identifies whether simple polygons are supported (either #Tag_true or #Tag_false).

A simple polygon is represented by a face \( f \) with no holes, no isolated vertex and any edge of \( f \) separates \( f \) from another face. Note that this allows \( f \) to touch a vertex from several sides.

Member Function Documentation

◆ attach()

void Visibility_2::attach ( const Arrangement_2 arr)

Attaches the given arrangement arr to the visibility object.

In case the object is already attached to another arrangement, the visibility object gets detached before being attached to arr.

◆ compute_visibility() [1/2]

template<typename VisibilityArrangement_2 >
Visibility_arrangement_2::Face_handle Visibility_2::compute_visibility ( const Point_2 q,
const Face_const_handle  f,
VisibilityArrangement_2 &  out_arr 
) const

Computes the visibility region for the given query point q in the face \( f \) of the arrangement that is attached to the visibility object.

The visibility region of q is stored in out_arr, that is, all features but the unbounded face of out_arr represent the visibility region.

Template Parameters
VisibilityArrangement_2is the type of the output arrangement representing the visibility polygon. It must be an instance of CGAL::Arrangement_2, where its CGAL::Arrangement_2::Traits_2 must be mutual convertible to VisibilityArrangement_2::Traits_2.
Parameters
qis the query point
fis the face of the arrangement in which the visibility region is computed
out_arris the output arrangement
Precondition
f is a face of this->arrangement_2()
q is in the interior of the given face f
Returns
the face handle to the face in out_arr that represents interior of the visibility region

◆ compute_visibility() [2/2]

template<typename VisibilityArrangement_2 >
Visibility_arrangement_2::Face_handle Visibility_2::compute_visibility ( const Point_2 q,
const Halfedge_const_handle  e,
Visibility_arrangement_2 &  out_arr 
) const

Computes the visibility region in e->face() for the given query point q which must be located on e.

If q is an interior point of e, the computed visibility region is restricted to the side indicated by the halfedge e. If q is an endpoint of e, the visibility region is restricted by e and e->next(). The visibility region of q is stored in out_arr, that is, all features but the unbounded face of out_arr represent the visibility region.

Template Parameters
VisibilityArrangement_2is the type of the output arrangement representing the visibility polygon. It must be an instance of CGAL::Arrangement_2, where its CGAL::Arrangement_2::Traits_2 must be mutual convertible to VisibilityArrangement_2::Traits_2.
Parameters
qis the query point
ethe halfedge on which q is located
out_arris the output arrangement
Precondition
e is a halfedge of this->arrangement_2()
q is on e
q equals to e->target()->point() if q is an endpoint of e
Returns
a handle to the face in out_arr that represents the interior of the visibility region