UNIVERS
15.3
UNIVERS base processing software API
|
#include <coord2d.hpp>
Public Member Functions | |
TransformCoord2D () | |
TransformCoord2D (double x0, double y0, double angle) | |
TransformCoord2D (double x0, double y0, double x1, double y1) | |
void | transform (double x, double y, double &x1, double &y1) const |
double | transformX (double x, double y) const |
double | transformY (double x, double y) const |
void | transformBack (double x1, double y1, double &x, double &y) const |
Protected Attributes | |
double | m_fA [2][2] |
double | m_fX0 |
double | m_fY0 |
Class for transformation of 2D coordinates from one cordinate system to another.
y y' ^ x' \ | / \ | / \|/)angle
---—+-----—> 0 x
On the picture x0=0 and y0=0.
Transformation is performed by next rule: x' = A[0][0] * (x - x0) + A[0][1] * (y - y0) y' = A[1][0] * (x - x0) + A[1][1] * (y - y0) where A[0][0] = cos(angle) A[0][1] = sin(angle) A[1][0] = - sin(angle) A[1][1] = cos(angle)
TransformCoord2D::TransformCoord2D | ( | ) |
Default coordinate system: (0,0) origin point; 0 angle.
TransformCoord2D::TransformCoord2D | ( | double | x0, |
double | y0, | ||
double | angle | ||
) |
Custom coordinate system x'0y' which is destination of transformation. x0, y0 is a coordinates of origin of destination coordinate system in source one. Angle is in radians.
TransformCoord2D::TransformCoord2D | ( | double | x0, |
double | y0, | ||
double | x1, | ||
double | y1 | ||
) |
Custom coordinate system x'0y' which is destination of transformation. x0, y0 is a coordinates of origin of destination coordinate system in source one. x1, y1 is a direction of x' from x0, y0.
void TransformCoord2D::transform | ( | double | x, |
double | y, | ||
double & | x1, | ||
double & | y1 | ||
) | const |
Main transformation procedure: x and y are in source coordinate system and x1, y1 are in destination coordinate system.
void TransformCoord2D::transformBack | ( | double | x1, |
double | y1, | ||
double & | x, | ||
double & | y | ||
) | const |
Reverse transformation procedure: x and y are in destination coordinate system and x1, y1 are in source coordinate system.
double TransformCoord2D::transformX | ( | double | x, |
double | y | ||
) | const |
Obtain x1 after transformation.
double TransformCoord2D::transformY | ( | double | x, |
double | y | ||
) | const |
Obtain y1 after transformation.
|
protected |
Transformation matrix.
|
protected |
Origin of destination coordinate system in source one.