To register a user defined type as a model of point concept, specialize the
geometry concept meta-function for that type. In the example below CPoint is registered as a model of
point concept.
template
coordinate_type get(const T& point, orientation_2d) |
Expects a model of point. Returns
the x or y coordinate of the point, depending on the orientation_2d
value.
|
template
void set(T& point, orientation_2d, coordinate_type) |
Expects a model of point.
Sets the x or y coordinate of the point to the coordinate, depending on
the orientation_2d value. |
template
T construct(coordinate_type x, coordinate_type y) |
Construct an object that is a model of point given x and y
coordinate values. |
template
T1& assign(T1& left, const T2& right) |
Copies data from right object that models point into left object
that models point. |
template
bool equivalence(const T& point1, const T2& point2) |
Given two objects that model point, compares and returns true if
their x and y values are respectively equal to each other. |
template
coordinate_type x(const point_type& point) |
Returns the x coordinate of an object that models point. |
template
coordinate_type y(const point_type& point) |
Returns the y coordinate of an object that models point. |
template
void x(point_type& point, coordinate_type ) |
Sets the x coordinate of the object that models point to the
coordinate value. |
template
void y(point_type& point, coordinate_type ) |
Sets the y coordinate of the object that models point to the
coordinate value. |
template
point_type& scale_up(point_type& point,
unsigned_area_type factor) |
Multiplies x and y coordinate of an object that models point by
unsigned factor. |
template
point_type& scale_down(point_type& point,
unsigned_area_type factor) |
Divides x and y coordinate of an object that models point by
unsigned factor. |
template
point_type& scale(point_type& point,
const scaling_type& factor) |
Calls the scale member function of scaling type on the x and y value
of an object that models point and sets the point to the scaled values. |
template
point_type& transform(point_type& point,
const transform_type& transform) |
Calls the transform member function of transform type on the x and y
value of an object that models point and sets the point to the
transformed values. |
template
point_type& move(point_type& point, orientation_2d
coordinate_difference displacement) |
Adds displacement value to the coordinate of an object that models
point indicated by the orientation_2d. |
template
T1& convolve(T1& a, const T2& b) |
Adds x coordinate of b to x coordinate of a and adds y coordinate of
b to y coordinate of a. |
template
T1& deconvolve(T1& a, const T2& b) |
Subtracts x coordinate of b from x coordinate of a and subtracts y
coordinate of b from y coordinate of a. |
template
coordinate_distance euclidean_distance(const T1&,
const T2&) |
Returns the distance from an object that models point to a second
object that models point. |
template
coordinate_difference euclidean_distance(const T&,
orientation_2d,
coordinate_type) |
Returns the distance from an object that models point to a
coordinate in the given orientation_2d. |
template
coordinate_difference manhattan_distance(const T1&,
const T2&) |
Returns the distance in x plus the distance in y from an object that
models point to a second object that models point. |
template
coordinate_difference distance_squared(const T1&,
const T2&) |
Returns the square of the distance in x plus the square of the
distance in y from an object that models point to a second object that
models point. |
This data type is used internally when a point is needed and is available to
the library user who finds it convenient to use a library point data type
instead of providing their own. The data type is implemented to be
convenient to use with the library traits.
geometry_type |
point_concept |
coordinate_type |
T |
point_data() |
Default constructs the two coordinate
values of the point. |
point_data(T x, T y) |
Constructs an interval with two
coordinates. |
point_data(const point_data*
that) |
Copy construct |
point_data& operator=(const
point_data& that) |
Assignment operator. |
template
point_data& operator=(const T2& that) const |
Assign from an object that is a model of point. |
template
bool
operator==(const T2& that) const |
Compare equality to an object that is a model of point. |
template
bool
operator!=(const T2& that) const |
Compare inequality to an object that is a model of point. |
template
bool
operator<(const T2& that) const |
Compares y coordinates then x coordinates to break ties. |
template
bool
operator<=(const T2& that) const |
Compares y coordinates then x coordinates to break ties. |
template
bool
operator>(const T2& that) const |
Compares low coordinates then high coordinates to break ties. |
template
bool
operator>=(const T2& that) const |
Compares low coordinates then high coordinates to break ties. |
T get(orientation_2d
orient) const |
Get the coordinate in the given orientation. |
T x() const |
Get the coordinate in the horizontal orientation. |
T y() const |
Get the coordinate in the vertical orientation. |
void set(orientation_2d
orient, T value) |
Sets the coordinate in the given orientation to the value. |
void x(T value) |
Sets the coordinate in the horizontal orientation to the value. |
void y(T value) |
Sets the coordinate in the vertical orientation to the value. |