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, const QString &needMoreText) |
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. More... | |
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 | TestExport |
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.
|
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 59 of file Transformation.cpp.