SnapRoundingTraits_2

Definition

The concept SnapRoundingTraits_2 lists the set of requirements that must be fulfilled by an instance of the Traits template-parameter of the function snap_rounding_2<Traits,InputIterator,OutputContainer>(). This concept provides the types of the geometric primitives used in this class and some function object types for the required predicates on those primitives.

Refines

This concept refines the standard concepts DefaultConstructible, Assignable and CopyConstructible. It also refines the concept SweepLineTraits_2 . An instance of this concept is used as the traits class for the Sweep_line_2.get_intersection_points() operation. The requirements listed below are induced by compnents of the snap_rounding_2() function other than the call to Sweep_line_2.get_intersection_points(). Naturally, some of them may already be listed in SweepLineTraits_2.

Types

SnapRoundingTraits_2::FT
The number type. This type must fulfill the requirements on FieldNumberType

SnapRoundingTraits_2::Point_2
The point type.

SnapRoundingTraits_2::Segment_2
The segment type.

SnapRoundingTraits_2::Iso_rectangle_2
The iso-rectangle type.


SnapRoundingTraits_2::Construct_vertex_2
Function object. Must provide the operator Point_2 operator()(Segment_2 seg, int i), which returns the source or target of seg. If i modulo 2 is 0, the source is returned, otherwise the target is returned.

SnapRoundingTraits_2::Construct_segment_2
Function object. Must provide the operator Segment_2 operator()(Point_2 p, Point_2 q), which introduces a segment with source p and target q. The segment is directed from the source towards the target.

SnapRoundingTraits_2::Construct_iso_rectangle_2
Function object. Must provide the operator Iso_rectangle_2 operator()(Point_2 left, Point_2 right, Point_2 bottom, Point_2 top), which introduces an iso-oriented rectangle fo whose minimal x coordinate is the one of left, the maximal x coordinate is the one of right, the minimal y coordinate is the one of bottom, the maximal y coordinate is the one of top.


SnapRoundingTraits_2::To_double
Function object. Must provide the operator double operator()(FT), which computes an approximation of a given number of type FT. The precision of this operation is of not high significance, as it is only used in the implementation of the heuristic technique to exploit a cluster of kd-trees rather than just one.

SnapRoundingTraits_2::Compare_x_2
Function object. Must provide the operator Comparison_result operator()(Point_2 p, Point_2 q) which returns SMALLER, EQUAL or LARGER according to the x-ordering of points p and q.

SnapRoundingTraits_2::Compare_y_2
Function object. Must provide the operator Comparison_result operator()(Point_2 p, Point_2 q) which returns SMALLER, EQUAL or LARGER according to the y-ordering of points p and q.

SnapRoundingTraits_2::Snap_2
Rounds a point to a center of a pixel (unit square) in the grid used by the Snap Rounding algorithm. Note that no conversion to an integer grid is done yet. Must have the syntax void operator()(Point_2 p,FT pixel_size,FT &x,FT &y) where p is the input point, pixel_size is the size of the pixel of the grid, and x and y are the x and y-coordinates of the rounded point respectively.


SnapRoundingTraits_2::Integer_grid_point_2
Convert coordinates into an integer representation where one unit is equal to pixel size. For instance, if a point has the coordinates (3.7,5.3) and the pixel size is 0.5, then the new point will have the coordinates of (7,10). Note, however, that the number type remains the same here, although integers are represented. Must have the syntax Point_2 operator()(Point_2 p,NT pixel_size) where p is the converted point and pixel_size is the size of the pixel of the grid.


SnapRoundingTraits_2::Minkowski_sum_with_pixel_2
Returns the vertices of a polygon, which is the Minkowski sum of a segment and a square centered at the origin with edge size pixel edge. Must have the syntax void operator()(std::list<Point_2>& vertices_list, Segment_2 s, NT unit_square) where vertices_list is the list of the vertices of the Minkowski sum polygon, s is the input segment and unit_square is the edge size of the pixel.

Creation

This concept refines the standard concepts DefaultConstructible, Assignable and CopyConstructible.

Operations

The following functions construct the required function objects occasionally referred as functors listed above.

Construct_vertex_2 traits.construct_vertex_2_object ()
Construct_segment_2
traits.construct_segment_2_object ()
Construct_iso_rectangle_2
traits.construct_iso_rectangle_2_object ()

Compare_x_2 traits.compare_x_2_object ()
Compare_y_2 traits.compare_y_2_object ()
Snap_2 traits.snap_2_object ()
Integer_grid_point_2
traits.integer_grid_point_2_object ()
Minkowski_sum_with_pixel_2
traits.minkowski_sum_with_pixel_2_object ()

Has Models

CGAL::Snap_rounding_traits<Kernel>

See Also

CGAL::Snap_rounding_2<Traits>