Space-efficient geometric algorithms and data structures

By Ilya Katz and Hervé Brönnimann    

cgl< NT, N > Class Template Reference

#include <cgl.hpp>


Detailed Description

template<class NT, std::size_t N = 2>
class cgl< NT, N >

Definition at line 22 of file cgl.hpp.

Public Types

typedef NT coord_type
 coordinate type (defined by the template)
typedef boost::array< coord_type, 2 > point_type
 a point is defined by 2 coordinates
typedef boost::array< point_type, 2 > line_type
 a line is defined by two points
typedef boost::array< coord_type,
N > 
multiD_point_type
 multi-D point
typedef boost::array< point_type, 4 > box_type
 a box is defined by 4 points
typedef boost::array< point_type, 3 > triangle_type
 triangle is defined by 3 points
typedef std::pair< boost::array<
point_type, 2 >, side
halfplane_type
enum  side { TOP, BOTTOM }
 a plane is defined by 2 points and side (top or bottom) More...

Public Member Functions

less_nth_object_type less_nth_object (std::size_t n)
 returns a functor to compare points by nth coordinate
less_x_object_type less_x_object ()
 returns a functor to compare points by x-coordinate
less_y_object_type less_y_object ()
 returns a functor to compare points by y-coordinate
less_xy_object_type less_xy_object ()
 returns a functor to compare points by both x- and y-coordinates
equals_xy_object_type equals_xy_object ()
 returns a functor to check equality of points
equals_lines_object_type equals_lines_object ()
point_type make_point (coord_type x, coord_type y)
 returns a point with given coordinates
coord_type get_x_coordinate (point_type p)
 returns x coordinate of the point
coord_type get_y_coordinate (point_type p)
 returns y coordinate of the point
box_type make_empty_box ()
 returns an empty box
box_type make_box (point_type ll, point_type ur)
 returns an open box
box_type make_box (coord_type left, coord_type right, coord_type top, coord_type bottom)
bool is_empty_box (box_type box)
 returns true if box is empty; false, otherwise
coord_type get_left (box_type Q)
 returns the coordinate of the left of the box
coord_type get_right (box_type Q)
 returns the coordinate of the right of the box
coord_type get_top (box_type Q)
 returns the coordinate of the top of the box
coord_type get_bottom (box_type Q)
 returns the coordinate of the bottom of the box
point_type lower_left (box_type box)
 returns the lower left cordinate of a box
point_type lower_right (box_type box)
 returns the lower right cordinate of a box
point_type upper_left (box_type box)
 returns the top left coordinate of a box
point_type upper_right (box_type box)
 returns the top right coordinate of a box
bool disjoint (box_type b1, box_type b2)
 returns true if two boxes have are disjoint
bool point_in_box (point_type p, box_type box)
 returns true of the point is contained with in the box
bool point_in_closed_box (point_type p, box_type box)
 returns true of the point is contained within the CLOSED box
bool contains (box_type inner, box_type outer)
 returns true if inner is indeed completely inside outer
box_type box_hull (box_type b1, box_type b2)
 returns the hull of two boxes
box_type intersection (box_type b1, box_type b2)
 returns a box that represents the intersection of two boxes
halfplane_type make_halfplane (point_type a, point_type b, side which_one)
 returns a halfplane defined by the points and the side
halfplane_type make_halfplane (point_type a, point_type b)
 returns a halfplane defined by the points
halfplane_type empty_halfplane ()
 returns an empty half plane
bool is_empty_halfplane (halfplane_type halfplane)
 returns true if given halfplane is empty
boost::array< point_type, 2 > get_halfplane_points (halfplane_type halfplane)
 returns an array with the two points that define the plane
bool is_TOP (halfplane_type halfplane)
 returns true if the plane is pointing up
bool is_BOTTOM (halfplane_type halfplane)
 returns true if the plane is pointing down
bool point_in_halfplane (point_type point, halfplane_type halfplane)
 returns true if point is within half plane.
if a point is collinear to the points that define the plane, false is returned
if plane is empty, false is returned
side top ()
 returns the representation of halfplane pointing up
side bottom ()
 returns the representation of halfplane pointing down
line_type make_line (const point_type &a, const point_type &b)
triangle_type make_trianlge (point_type a, point_type b, point_type c)
 returns a triangle made from three points
bool point_in_open_triangle (point_type p, triangle_type t)
 return true if point p is inside closes triangle
bool point_in_closed_triangle (point_type p, triangle_type t)
 return true if point p is inside open triangle

Private Types

enum  type { LEFT_TURN, COLLINEAR, RIGHT_TURN }

Private Member Functions

type _point_position (point_type plane_point1, point_type plane_point2, point_type point)

Data Structures

struct  less_x_object_type
 functor that is used to determine whether a point is less then another by comparing the x-coordinates More...
struct  equals_lines_object_type
struct  equals_xy_object_type
 functor that returns equality of two points More...
struct  less_nth_object_type
 functor to compare multidimensional points by the specific dimension cooordinate More...
struct  less_xy_object_type
 functor that is used to determine whether a point is less then another by comparing both coordinates More...
struct  less_y_object_type
 functor that is used to determine whether a point is less then another by comparing the y-coordinates More...


The documentation for this class was generated from the following file:

Code Documentation generated Using Doxygen

Copyright © Ilya Katz and Hervé Brönnimann, 2005, 2006.