PlanarMapTraits_2

Definition

A model of the PlanarMapTraits_2 concept aggregates the geometric types and primitive operations used by the Planar_map_2<PlanarMapDcel_2,PlanarMapTraits_2> data structure. It must provide the types and operations listed below.

Types

The geometric types defined below must have a default constructor, copy constructor, assignment operator and operator==.

PlanarMapTraits_2::X_monotone_curve_2
A type that holds an x-monotone curve in the plane.


PlanarMapTraits_2::Point_2
A type that holds the position of a vertex in the plane. The type of the end points of X_monotone_curve_2 curves.

Categories

The following categories declare the implementation of the method curves_compare_y_at_x_left(). If the category Has_left_category is Tag_true the method is required specifically. Otherwise, if the category Has_reflect_category is Tag_true the method curves_compare_y_at_x_left() is implemented using the required methods point_reflect_in_x_and_y() and curve_reflect_in_x_and_y(). If none of the categories is Tag_true, a default implementation is used, that does not require any of the above methods.

PlanarMapTraits_2::Has_left_category
A boolean category that indicates whether the method curves_compare_y_at_x_left() is required. It must be either Tag_true or Tag_false.


PlanarMapTraits_2::Has_reflect_category
A boolean category that indicates whether the methods point_reflect_in_x_and_y() and curve_reflect_in_x_and_y() are required. It must be either Tag_true or Tag_false.

Enumerations

enum Comparison_result { SMALLER , EQUAL , LARGER };
a constant describing the relative position between objects.

Creation

PlanarMapTraits_2 pm_traits;
A default constructor.

Operations

The following methods that have a curve parameter of type X_monotone_curve_2 have the implicit precondition that requires the curve to be x-monotone.

Comparison_result pm_traits.compare_x ( Point_2 p0, Point_2 p1)
compares the x-coordinates of p0 and p1. Returns LARGER if x(p0) > x(p1); SMALLER if x(p0) < x(p1); EQUAL otherwise.

Comparison_result pm_traits.compare_xy ( Point_2 p0, Point_2 p1)
compares the two points p0 and p1 lexigoraphically. First the x-coordinates are compared. In case of a tie, the y-coordinates are compared. Returns LARGER if x(p1) > x(p2), or if x(p1) = x(p2) and y(p1) > y(p2); SMALLER if x(p1) < x(p2), or if x(p1) = x(p2) and y(p1) < y(p2); EQUAL otherwise.

bool pm_traits.curve_is_vertical ( X_monotone_curve_2 cv)
returns true if cv is a vertical segment, false otherwise.

bool
pm_traits.point_in_x_range ( X_monotone_curve_2 cv,
Point_2 pnt)
returns true if pnt is in the x range of cv, false otherwise.

Comparison_result
pm_traits.curves_compare_y_at_x ( X_monotone_curve_2 cv1,
X_monotone_curve_2 cv2,
Point_2 pnt)
compares the y-coordinate of cv1 and cv2 at the x-coordinate of pnt. Returns LARGER if cv1(x(q)) > cv2(x(q)); SMALLER if cv1(x(q)) < cv2(x(q)); EQUAL otherwise.
Precondition: cv1 and cv2 are defined at pnt's x-coordinate.

Comparison_result
pm_traits.curves_compare_y_at_x_right ( X_monotone_curve_2 cv1,
X_monotone_curve_2 cv2,
Point_2 pnt)
compares the y-coordinate of cv1 and cv2 immediately to the right of the x-coordinate of pnt.
Precondition: cv1 and cv2 meet at pnt x-coordinate.
Precondition: cv1 and cv2 are defined lexigoraphically to the right of pnt's x-coordinate.

Comparison_result
pm_traits.curves_compare_y_at_x_left ( X_monotone_curve_2 cv1,
X_monotone_curve_2 cv2,
Point_2 pnt)
compares the y-coordinate of cv1 and cv2 immediately to the left of the x-coordinate of pnt. This predicate is not required for the aggregate insertion of curves into the planar map. Recall, that the aggregate insertion is based on a sweep-line algorithm.
Precondition: cv1 and cv2 meet at pnt x-coordinate.
Precondition: cv1 and cv2 are defined lexigoraphically to the left of pnt's x-coordinate.

Point_2 pm_traits.point_reflect_in_x_and_y ( Point_2 pt)
returns the reflection of the point pt about the origin For example, the reflection of the point (2,2) is the point as (-2,-2). This predicate is not required for the aggregate insertion of curves into the planar map, or if the method curves_compare_y_at_x_left() is provided and the Has_left_category category is Tag_true.

X_monotone_curve_2
pm_traits.curve_reflect_in_x_and_y ( X_monotone_curve_2 cv)
returns the reflection of the curve cv about the origin. For example, the reflection of the line segment ((2,2),(3,3)) is ((-2,-2),(-3,-3)). This predicate is not required for the aggregate insertion of curves into the planar map, or if the method curves_compare_y_at_x_left() is provided and the Has_left_category category is Tag_true.

Comparison_result
pm_traits.curve_compare_y_at_x ( Point_2 pnt,
X_monotone_curve_2 cv)
compares the y-coordinates of pnt and the vertical projection of pnt on cv. Returns SMALLER if y(pnt) < cv(x(pnt)); LARGER if y(pnt) > cv(x(pnt)); EQUAL otherwise (pnt is on the curve).
Precondition: cv is defined at pnt's x-coordinate.

bool
pm_traits.curve_equal ( X_monotone_curve_2 cv1,
X_monotone_curve_2 cv2)
returns true if cv1 and cv2 have the same graph, false otherwise.

bool pm_traits.point_equal ( Point_2 p1, Point_2 p2)
returns true if p1 is the same as p2, false otherwise.

Point_2 pm_traits.curve_source ( X_monotone_curve_2 cv)
returns the source of cv.

Point_2 pm_traits.curve_target ( X_monotone_curve_2 cv)
returns the target of cv.

Has Models

Pm_segment_traits_2<Kernel>

The PlanarMapWithIntersectionsTraits_2 and ArrangementTraits_2 concepts are refinements of the PlanarMapTraits_2 concept, in other words, a model of the formers is a model of the latter. Thus, all supplied (or user written ) arrangement traits classes can be passed as the Traits template parameter when instantiating an object of type Planar_map_2<Dcel,Traits>. See the list of the arrangement traits classes in chapter  reference, Arrangement.