Class implementing mathematical model of 2D coordinate system. More...
#include <GLViewer_CoordSystem.h>
Public Types | |
| enum | CSType { Cartesian, Polar } |
A type of coordinate system. More... | |
Public Member Functions | |
| GLViewer_CoordSystem (CSType aType, double X0=0.0, double Y0=0.0, double XUnit=1.0, double YUnit=1.0, double Rotation=0.0) | |
| A constructor ( by default new system is identical to reference ) | |
| void | getOrigin (double &x, double &y) const |
| Returns the origin in reference system. | |
| void | setOrigin (double x, double y) |
| A function installing the origin in reference system. | |
| void | getUnits (double &x, double &y) const |
| Returns units along axes. | |
| void | setUnits (double x, double y) |
| A function installing units along axes. | |
| double | getRotation () const |
| Returns rotation angle of axes in reference system. | |
| void | setRotation (double rotation) |
| A function installing rotation angle of axes in reference system. | |
| CSType | getType () const |
| Returns type of system. | |
| void | setType (CSType type) |
| A function installing type of system. | |
| void | transform (GLViewer_CoordSystem &aSystem, double &x, double &y) |
| Transform the coordinates x, y from current CS to aSystem. | |
| virtual void | getStretching (GLViewer_CoordSystem &aSystem, double &theX, double &theY) |
| Return how many times line width in aSystem system bigger than in current. | |
Protected Member Functions | |
| virtual void | toReference (double &x, double &y) |
| A function transforms system coords to coords in reference system. | |
| virtual void | fromReference (double &x, double &y) |
| A function transforms from coords in reference system to system coords. | |
Private Attributes | |
| double | myX0 |
| The coordinates of origin in the reference CS. | |
| double | myY0 |
| double | myXUnit |
| The lengths of axis units in the reference unit. | |
| double | myYUnit |
| double | myRotation |
| The rotation in radians relative to reference CS. | |
| CSType | myType |
| In the polar CS myYUnit is ignored, but myXUnit is the unit of polar radius. | |
Class GLViewer_CoordSystem Class implementing mathematical model of 2D coordinate system
| GLViewer_CoordSystem::GLViewer_CoordSystem | ( | CSType | aType, |
| double | X0 = 0.0, |
||
| double | Y0 = 0.0, |
||
| double | XUnit = 1.0, |
||
| double | YUnit = 1.0, |
||
| double | Rotation = 0.0 |
||
| ) |
Constructor
| aType | - type of CS |
| X0 | - X of origin in reference CS |
| Y0 | - Y of origin in reference CS |
| XUnit | - X unit in reference CS |
| YUnit | - Y unit in reference CS |
| Rotation | - rotation relative reference CS |
References setOrigin(), setRotation(), setType(), and setUnits().
| void GLViewer_CoordSystem::getOrigin | ( | double & | x, |
| double & | y | ||
| ) | const |
| void GLViewer_CoordSystem::setOrigin | ( | double | x, |
| double | y | ||
| ) |
| void GLViewer_CoordSystem::getUnits | ( | double & | x, |
| double & | y | ||
| ) | const |
| void GLViewer_CoordSystem::setUnits | ( | double | x, |
| double | y | ||
| ) |
| double GLViewer_CoordSystem::getRotation | ( | ) | const |
References myRotation.
| void GLViewer_CoordSystem::setRotation | ( | double | rotation | ) |
Sets rotation
References myRotation.
| GLViewer_CoordSystem::CSType GLViewer_CoordSystem::getType | ( | ) | const |
References myType.
| void GLViewer_CoordSystem::transform | ( | GLViewer_CoordSystem & | aSystem, |
| double & | x, | ||
| double & | y | ||
| ) |
Recalculate co-ordinates to co-ordinates of other CS
| aSystem | - other CS |
| x,y | - co-ordinates |
References fromReference(), and toReference().
| void GLViewer_CoordSystem::getStretching | ( | GLViewer_CoordSystem & | aSystem, |
| double & | theX, | ||
| double & | theY | ||
| ) | [virtual] |
| void GLViewer_CoordSystem::toReference | ( | double & | x, |
| double & | y | ||
| ) | [protected, virtual] |
| void GLViewer_CoordSystem::fromReference | ( | double & | x, |
| double & | y | ||
| ) | [protected, virtual] |
double GLViewer_CoordSystem.myX0 [private] |
double GLViewer_CoordSystem.myY0 [private] |
double GLViewer_CoordSystem.myXUnit [private] |
double GLViewer_CoordSystem.myYUnit [private] |
double GLViewer_CoordSystem.myRotation [private] |
CSType GLViewer_CoordSystem.myType [private] |