Engauge Digitizer 2
|
Affine transformation between screen and graph coordinates, based on digitized axis points. More...
#include <Transformation.h>
Public Member Functions | |
Transformation () | |
Default constructor. This is marked as undefined until the proper number of axis points are added. | |
Transformation (const Transformation &other) | |
Copy constructor. | |
Transformation & | operator= (const Transformation &other) |
Assignment operator. | |
void | identity () |
Identity transformation. | |
bool | operator!= (const Transformation &other) |
Inequality operator. This is marked as defined. | |
void | coordTextForStatusBar (QPointF cursorScreen, QString &coordsScreen, QString &coordsGraph, QString &resolutionGraph, bool usingScaleBar) |
Return string descriptions of cursor coordinates for status bar. | |
DocumentModelCoords | modelCoords () const |
Get method for DocumentModelCoords. | |
DocumentModelGeneral | modelGeneral () const |
Get method for DocumentModelGeneral. | |
MainWindowModel | modelMainWindow () const |
Get method for MainWindowModel. | |
void | printStream (QString indentation, QTextStream &str) const |
Debugging method that supports print method of this class and printStream method of some other class(es) | |
void | resetOnLoad () |
Reset, when loading a document after the first, to same state that first document was at when loaded. | |
bool | transformIsDefined () const |
Transform is defined when at least three axis points have been digitized. | |
void | transformLinearCartesianGraphToRawGraph (const QPointF &coordGraph, QPointF &coordScreen) const |
Transform from linear cartesian graph coordinates to cartesian, polar, linear, log coordinates. | |
void | transformLinearCartesianGraphToScreen (const QPointF &coordGraph, QPointF &coordScreen) const |
Transform from linear cartesian graph coordinates to cartesian pixel screen coordinates. | |
QTransform | transformMatrix () const |
Get method for copying only, for the transform matrix. | |
void | transformRawGraphToLinearCartesianGraph (const QPointF &pointRaw, QPointF &pointLinearCartesian) const |
Convert graph coordinates (linear or log, cartesian or polar) to linear cartesian coordinates. | |
void | transformRawGraphToScreen (const QPointF &pointRaw, QPointF &pointScreen) const |
Transform from raw graph coordinates to linear cartesian graph coordinates, then to screen coordinates. | |
void | transformScreenToLinearCartesianGraph (const QPointF &pointScreen, QPointF &pointLinearCartesian) const |
Transform screen coordinates to linear cartesian coordinates. | |
void | transformScreenToRawGraph (const QPointF &coordScreen, QPointF &coordGraph) const |
Transform from cartesian pixel screen coordinates to cartesian/polar graph coordinates. | |
void | update (bool fileIsLoaded, const CmdMediator &cmdMediator, const MainWindowModel &modelMainWindow) |
Update transform by iterating through the axis points. |
Static Public Member Functions | |
static QTransform | calculateTransformFromLinearCartesianPoints (const QPointF &posFrom0, const QPointF &posFrom1, const QPointF &posFrom2, const QPointF &posTo0, const QPointF &posTo1, const QPointF &posTo2) |
Calculate QTransform using from/to points that have already been adjusted for, when applicable, log scaling and polar coordinates. | |
static QPointF | cartesianFromCartesianOrPolar (const DocumentModelCoords &modelCoords, const QPointF &posGraphIn) |
Output cartesian coordinates from input cartesian or polar coordinates. This is static for easier use externally. | |
static QPointF | cartesianOrPolarFromCartesian (const DocumentModelCoords &modelCoords, const QPointF &posGraphIn) |
Output cartesian or polar coordinates from input cartesian coordinates. This is static for easier use externally. | |
static double | logToLinearCartesian (double xy) |
Convert cartesian scaling from log to linear. Calling code is responsible for determining if this is necessary. | |
static double | logToLinearRadius (double r, double rCenter) |
Convert radius scaling from log to linear. Calling code is responsible for determining if this is necessary. |
Friends | |
class | TestCentipedeEndpoints |
class | TestExport |
class | TestSplineDrawer |
class | TestTransformation |
Affine transformation between screen and graph coordinates, based on digitized axis points.
Transformation from screen pixels to graph coordinates involves two steps:
Transformation from graph coordinates to screen pixels reverses the steps involved in the transformation from screen pixels to graph coordinates
Log scaling is calculated as (xLinear - xLogMin) / (xLogMax - xLogMin) = (ln(xLog) - ln(xLogMin)) / (ln(xLogMax) - ln(xLogMin)), which leaves the points (xLogMin,yLonMin) and (xLogMax,yLogMax) unaffected but gives log growth on all other points
Definition at line 31 of file Transformation.h.
Transformation::Transformation | ( | ) |
Default constructor. This is marked as undefined until the proper number of axis points are added.
Definition at line 27 of file Transformation.cpp.
Transformation::Transformation | ( | const Transformation & | other | ) |
Copy constructor.
Definition at line 32 of file Transformation.cpp.
|
static |
Calculate QTransform using from/to points that have already been adjusted for, when applicable, log scaling and polar coordinates.
The points are linear and cartesian.
This method is kept very generic since it used for different types of transformations:
Definition at line 58 of file Transformation.cpp.
|
static |
Output cartesian coordinates from input cartesian or polar coordinates. This is static for easier use externally.
Definition at line 80 of file Transformation.cpp.
|
static |
Output cartesian or polar coordinates from input cartesian coordinates. This is static for easier use externally.
Definition at line 123 of file Transformation.cpp.
void Transformation::coordTextForStatusBar | ( | QPointF | cursorScreen, |
QString & | coordsScreen, | ||
QString & | coordsGraph, | ||
QString & | resolutionGraph, | ||
bool | usingScaleBar ) |
Return string descriptions of cursor coordinates for status bar.
Definition at line 166 of file Transformation.cpp.
void Transformation::identity | ( | ) |
Identity transformation.
Definition at line 241 of file Transformation.cpp.
|
static |
Convert cartesian scaling from log to linear. Calling code is responsible for determining if this is necessary.
Definition at line 250 of file Transformation.cpp.
|
static |
Convert radius scaling from log to linear. Calling code is responsible for determining if this is necessary.
Definition at line 255 of file Transformation.cpp.
DocumentModelCoords Transformation::modelCoords | ( | ) | const |
Get method for DocumentModelCoords.
Definition at line 261 of file Transformation.cpp.
DocumentModelGeneral Transformation::modelGeneral | ( | ) | const |
Get method for DocumentModelGeneral.
Definition at line 266 of file Transformation.cpp.
MainWindowModel Transformation::modelMainWindow | ( | ) | const |
Get method for MainWindowModel.
Definition at line 271 of file Transformation.cpp.
bool Transformation::operator!= | ( | const Transformation & | other | ) |
Inequality operator. This is marked as defined.
Definition at line 52 of file Transformation.cpp.
Transformation & Transformation::operator= | ( | const Transformation & | other | ) |
Assignment operator.
Definition at line 41 of file Transformation.cpp.
void Transformation::printStream | ( | QString | indentation, |
QTextStream & | str ) const |
Debugging method that supports print method of this class and printStream method of some other class(es)
Definition at line 288 of file Transformation.cpp.
void Transformation::resetOnLoad | ( | ) |
Reset, when loading a document after the first, to same state that first document was at when loaded.
Definition at line 309 of file Transformation.cpp.
bool Transformation::transformIsDefined | ( | ) | const |
Transform is defined when at least three axis points have been digitized.
Definition at line 334 of file Transformation.cpp.
void Transformation::transformLinearCartesianGraphToRawGraph | ( | const QPointF & | coordGraph, |
QPointF & | coordScreen ) const |
Transform from linear cartesian graph coordinates to cartesian, polar, linear, log coordinates.
Definition at line 339 of file Transformation.cpp.
void Transformation::transformLinearCartesianGraphToScreen | ( | const QPointF & | coordGraph, |
QPointF & | coordScreen ) const |
Transform from linear cartesian graph coordinates to cartesian pixel screen coordinates.
Definition at line 378 of file Transformation.cpp.
QTransform Transformation::transformMatrix | ( | ) | const |
Get method for copying only, for the transform matrix.
Definition at line 386 of file Transformation.cpp.
void Transformation::transformRawGraphToLinearCartesianGraph | ( | const QPointF & | pointRaw, |
QPointF & | pointLinearCartesian ) const |
Convert graph coordinates (linear or log, cartesian or polar) to linear cartesian coordinates.
Definition at line 391 of file Transformation.cpp.
void Transformation::transformRawGraphToScreen | ( | const QPointF & | pointRaw, |
QPointF & | pointScreen ) const |
Transform from raw graph coordinates to linear cartesian graph coordinates, then to screen coordinates.
Definition at line 433 of file Transformation.cpp.
void Transformation::transformScreenToLinearCartesianGraph | ( | const QPointF & | pointScreen, |
QPointF & | pointLinearCartesian ) const |
Transform screen coordinates to linear cartesian coordinates.
Definition at line 444 of file Transformation.cpp.
void Transformation::transformScreenToRawGraph | ( | const QPointF & | coordScreen, |
QPointF & | coordGraph ) const |
Transform from cartesian pixel screen coordinates to cartesian/polar graph coordinates.
Definition at line 452 of file Transformation.cpp.
void Transformation::update | ( | bool | fileIsLoaded, |
const CmdMediator & | cmdMediator, | ||
const MainWindowModel & | modelMainWindow ) |
Update transform by iterating through the axis points.
Definition at line 462 of file Transformation.cpp.
|
friend |
Definition at line 34 of file Transformation.h.
|
friend |
Definition at line 35 of file Transformation.h.
|
friend |
Definition at line 36 of file Transformation.h.
|
friend |
Definition at line 37 of file Transformation.h.