Go to the first, previous, next, last section, table of contents.


CNCoord -- 2-Dimensional Coordinates

SYNOPSIS

#include <CNCL/Coord.h>

TYPE

CN_COORD

BASE CLASSES

CNObject

DERIVED CLASSES

None

RELATED CLASSES

CNICoord

DESCRIPTION

CNCoord is a data type for managing 2-dimensional coordinates. It is typically used together with CNICoord for world coordinates and pixel coordinates respectively.
A CNCoord has double x and y members which are public accessible.
CNCoords can be automatically converted to CNICoords and vice versa. This is done by applying the conversion factor CNCoord::scale.

Constructors:

CNCoord();
CNCoord(CNParam *param);
CNCoord(double vx, double vy);
CNCoord(const CNICoord &v);
CNCoord(const CNCoord &v);
Initializes the coordinates object and optionally sets x and y components.

Public accessible members:

double x;
double y;
The x and y components of CNCoord.

In addition to the member functions required by CNCL, CNCoord provides:

CNCoord &operator = (const CNCoord &v);
CNCoord &operator += (const CNCoord &v);
CNCoord &operator -= (const CNCoord &v);
Defines the operators =, += and -= for coordinates by applying the standard C/C++ operators to the x and y components.

The following static member functions are provided to manipulate the conversion scale setting:

static double CNCoord::get_scale();
static double CNCoord::set_scale(double new_scale);
Gets/sets the scale setting.

Global operators:

CNCoord operator + (const CNCoord &a, const CNCoord &b);
CNCoord operator - (const CNCoord &a, const CNCoord &b);
Adds/substracts coordinates by adding/subtracting the x and y components.


Go to the first, previous, next, last section, table of contents.