Engauge Digitizer 2
Loading...
Searching...
No Matches
GuidelineProjectorConstantR.cpp
Go to the documentation of this file.
1/******************************************************************************************************
2 * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released *
3 * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file *
4 * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. *
5 ******************************************************************************************************/
6
7#include <algorithm>
8#include "EllipseParameters.h"
10#include "Logger.h"
11#include "mmsubs.h"
12#include <QList>
13#include <qmath.h>
14#include <QRectF>
15#include "Transformation.h"
16
20
24
26 const QRectF & /* sceneRect */,
27 double rGraph)
28{
29 // Points at 45, 135, 225 and 315 degrees at range rGraph
39
40 double angleRadians = 0, aAligned = 0, bAligned = 0;
47 angleRadians,
49 bAligned);
50
52 angleRadians,
54 bAligned);
55}
56
58 const QRectF &sceneRect,
59 const QPointF &posScreen)
60{
61 QPointF posGraph;
62 transformation.transformScreenToRawGraph (posScreen, posGraph);
63
64 double rGraph = posGraph.y();
65
66 if (transformation.modelCoords().coordScaleYRadius() == COORD_SCALE_LOG) {
67 if (rGraph <= 0) {
68
69 // Range enforcement on the range values with log scale should have prevented this branch
70 LOG4CPP_ERROR_S ((*mainCat)) << "GuidelineProjectorConstantR::fromPosScreen out of bounds range " << rGraph;
71
72 } else {
73
74 // Adjust radius from log to linear so, after conversion to cartesian, we have linear x and y
75 rGraph = qLn (rGraph);
76
77 }
78 }
79
80 return fromCoordinateR (transformation,
81 sceneRect,
82 rGraph);
83}
@ COORD_SCALE_LOG
Definition CoordScale.h:14
const int INNER_RADIUS_MIN
log4cpp::Category * mainCat
Definition Logger.cpp:14
CoordScale coordScaleYRadius() const
Get method for linear/log scale on y/radius.
Parameters that define an ellipse about the specified center, at the specified angle from alignment w...
EllipseParameters fromCoordinateR(const Transformation &transformation, const QRectF &sceneRect, double rGraph)
Return line through y in graph coordinates.
EllipseParameters fromPosScreen(const Transformation &transformation, const QRectF &sceneRect, const QPointF &posScreen)
Return line through point in screen coordinates.
Affine transformation between screen and graph coordinates, based on digitized axis points.
void transformScreenToRawGraph(const QPointF &coordScreen, QPointF &coordGraph) const
Transform from cartesian pixel screen coordinates to cartesian/polar graph coordinates.
DocumentModelCoords modelCoords() const
Get method for DocumentModelCoords.
void transformLinearCartesianGraphToScreen(const QPointF &coordGraph, QPointF &coordScreen) const
Transform from linear cartesian graph coordinates to cartesian pixel screen coordinates.
#define LOG4CPP_ERROR_S(logger)
Definition convenience.h:12
void ellipseFromParallelogram(double xTL, double yTL, double xTR, double yTR, double xBR, double yBR, double &angleRadians, double &aAligned, double &bAligned)
Calculate ellipse parameters that is incribed in a parallelogram centered at the origin,...
Definition mmsubs.cpp:52