Navigation: Up, Table of Contents, Bibliography, Index, Title Page

2D Planar Map (Planar_map_2)

Definition

An object pm of the class Planar_map_2<Dcel,Traits> is the planar subdivision induced by a set of x-monotone curves such that no curve intersects the interior of any other curve. The available traits and dcel classes will be described later.

#include <CGAL/Planar_map_2.h>

Inherits From

Topological_map<Dcel>

The modifying functions insert_in_face_interior, insert_from_vertex , insert_at_vertices, split_edge, merge_edge and remove_edge overwrite the inherited functions and make use of the geometric information of the planar map.

Types

typedef Planar_map_2<Dcel,Traits>
Self;

Planar_map_2<Dcel,Traits>::Traits
traits class.


Planar_map_2<Dcel,Traits>::Dcel
DCEL class.

typedef typename Traits::X_curve
X_curve; a curve of the planar map.

typedef typename Traits::Point
Point; a point of the planar map.

enum Locate_type { VERTEX = 1, EDGE, FACE, UNBOUNDED_FACE};
an enumeration that specifies the result of point location and ray shooting operations.

Creation

Planar_map_2<Dcel,Traits> pm;
constructs an ``empty map'' containing one unbounded face, which corresponds to the whole plane.


begin of advanced section

Point Location Strategies

The Planar_map<Dcel,Traits> class has a point location function (namely, the locate function that determines which feature of the map contains a given query point) which is also used internally in the insert function. There are several known algorithms for solving a point location query. We have implemented three - the randomized incremental algorithm introduced by Mulmuley  [Mul90],  [Sei91],  [dBvKOS97], the naive algorithm (which goes over all vertices and edges) and a ``walk'' algorithm that is an improvement over the naive one. The first algorithm uses a trapezoidal map structure for achieving an expected query time of O(logn) for a map with n edges. The randomized algorithm is the one used by default in our implementation. However, the users can choose to use the naive or ``walk'' algorithms (trading time for memory efficiency) or can implement their own point location algorithm. This is done with a class derived from the Point_location_base<Planar_map> class which is passed as a parameter in the constructor. The description of the class is given in Section reference.

Planar_map_2<Dcel,Traits> pm ( Pm_point_location_base<Self> *pl_ptr);


end of advanced section

Operations

Halfedge_handle pm.insert ( X_curve cv)
inserts the curve cv into the map.
Precondition: No curve cv1 of pm intersects cv in the interiors of cv and cv1.


begin of advanced section

Specialized Insertion Functions

The following functions enable the usage of information about the map which was acquired beforehand, to save time in insertions. It is recommended to use these functions with the naive point location strategy.

Halfedge_handle
pm.insert_at_vertices ( X_curve cv,
Vertex_handle v1,
Vertex_handle v2)
inserts cv as a new edge between v1 and v2, where v1 and v2 are vertices of the map. v1 and v2 represent the source and target of the returned halfedge.
Precondition: v1->point() and v2->point() are the two endpoints of cv.

Halfedge_handle
pm.insert_from_vertex ( X_curve cv,
Vertex_handle v1,
bool source)
inserts a new edge for which one endpoint, v1, is already in the map. The returned halfedge is the one that has v1 as it's source. If source is true (resp. false) then the target of the returned halfedge holds the point which is cv's target (resp. source).
Precondition: the second endpoint of cv is not in the map.

Halfedge_handle
pm.insert_in_face_interior ( X_curve cv,
Face_handle f)
inserts cv as a new inner component of f.
Precondition: cv is contained completely in the interior of f (no vertex of cv meets any vertex on the map).

end of advanced section

Query Functions

The following two functions are query functions. Their time complexity depends on the point location strategy used.

Halfedge_handle pm.locate ( Point p, Locate_type& lt)
computes the location in pm where p lies; If lt returns VERTEX then p lies on the vertex which is the target of the returned Halfedge. If lt returns EDGE then p lies on the returned Halfedge. If lt returns FACE then p lies on the face which is on the left of the returned Halfedge . If lt returns UNBOUNDED_FACE then p lies on the unbounded face, and the returned Halfedge is on the boundary of a hole in the unbounded face.

Halfedge_handle
pm.vertical_ray_shoot ( Point p,
Locate_type& lt,
bool up_direction)
if up_direction is true (resp. false) returns the first edge of pm that intersects the upward (resp. downward) vertical ray emanating from p. If several edges intersect the vertical ray in the same (end)point q, the function returns the first halfedge pointing at q, that is encountered when moving clockwise from $pq$ around q . In that case the value of lt will be VERTEX . If the ray does not intersect any edge, the value of lt will be UNBOUNDED_FACE and the Halfedge returned will be null valued. Otherwise the value of lt will be EDGE.
Precondition: p lies in the interior of a face of pm, i.e., not on an edge or on a vertex.
Postcondition: the returned edge belongs to one of the CCB's of the face in which p is found, null valued if none is found.


begin of advanced section
For some applications the users may want to have direct access to the point location strategy (e.g., query the default strategy about the state of its internal search structure). For this we have implemented the following function, note that the returned pointer is const so the users cannot change the internal state.

const Pm_point_location_base<Self>*
pm.point_location ()
returns a const pointer to the point location strategy of the map.


end of advanced section

Modifying Functions

Halfedge_handle
pm.split_edge ( Halfedge_handle e,
X_curve c1,
X_curve c2)
splits the edge e into e1 and e2 , and add a vertex in the splitting point. If the source point of e is identical to the source of the curve c1 then c1 will be assigned to e1 and c2 to e2. Otherwise, the opposite will take place. The returned halfedge will be e1 where e2 is e1->next_halfedge().
Precondition: the preconditions of Topological_map<Dcel>::split_edge.
Precondition: the target of the curve c1 is identical to the source of the curve c2.
Precondition: the source of the curve c1 is identical to the source point of e and the target of the curve c2 is identical to the target point of e, or the source of the curve c1 is identical to the target point of e and the target of the curve c2 is identical to the source point of e.

Halfedge_handle
pm.merge_edge ( Halfedge_handle e1,
Halfedge_handle e2,
X_curve cv)
merges the edges e1 and e2 into one edge which will hold the curve cv. The return value is the halfedge with the same source vertex that e1 had and the same target e2 had.
Precondition: the preconditions of Topological_map<Dcel>::merge_edge.
Precondition: the source of the curve cv is identical to the source point of e1 and the target of the curve cv is identical to the target point of e2, or the target of the curve cv is identical to the source point of e1 and the source of the curve cv is identical to the target point of e2.

Face_handle pm.remove_edge ( Halfedge_handle e)
removes the edge e from pm. If the operation causes two faces to merge, the merged face is returned. Otherwise, the face to which the edge was incident is returned.


Next: Class declaration of Vertex
Navigation: Up, Table of Contents, Bibliography, Index, Title Page
The GALIA project. Jan 18, 2000.