Engauge Digitizer 2
Loading...
Searching...
No Matches
GuidelineProjectorConstantT Class Reference

Project a point along the radial direction in graph coordinates to produce a curve along the constant-theta direction, passing through a specified point. More...

#include <GuidelineProjectorConstantT.h>

Inheritance diagram for GuidelineProjectorConstantT:
Inheritance graph
Collaboration diagram for GuidelineProjectorConstantT:
Collaboration graph

Public Member Functions

 GuidelineProjectorConstantT ()
 Single constructor.
 ~GuidelineProjectorConstantT ()
QLineF fromCoordinateT (const Transformation &transformation, const QRectF &sceneRect, double tGraph)
 Return line through theta in graph coordinates.
QLineF fromPosScreen (const Transformation &transformation, const QRectF &sceneRect, const QPointF &posScreen)
 Return line through point in screen coordinates.
Public Member Functions inherited from GuidelineProjectorAbstract
 GuidelineProjectorAbstract ()
 Single constructor.
 ~GuidelineProjectorAbstract ()

Additional Inherited Members

Protected Member Functions inherited from GuidelineProjectorAbstract
void calculateCorners (const Transformation &transformation, const QRectF &sceneRect, QPointF &posGraphBL, QPointF &posGraphTL, QPointF &posGraphTR, QPointF &posGraphBR) const
 Conpute four corners of scene in graph coordinates.
bool isOutside (const QRectF &sceneRect, const QPointF &posScreen) const
 Return true if point is outside of the scene.

Detailed Description

Project a point along the radial direction in graph coordinates to produce a curve along the constant-theta direction, passing through a specified point.

Definition at line 20 of file GuidelineProjectorConstantT.h.

Constructor & Destructor Documentation

◆ GuidelineProjectorConstantT()

GuidelineProjectorConstantT::GuidelineProjectorConstantT ( )

Single constructor.

Definition at line 14 of file GuidelineProjectorConstantT.cpp.

15{
16}

◆ ~GuidelineProjectorConstantT()

GuidelineProjectorConstantT::~GuidelineProjectorConstantT ( )

Definition at line 18 of file GuidelineProjectorConstantT.cpp.

19{
20}

Member Function Documentation

◆ fromCoordinateT()

QLineF GuidelineProjectorConstantT::fromCoordinateT ( const Transformation & transformation,
const QRectF & sceneRect,
double tGraph )

Return line through theta in graph coordinates.

Definition at line 22 of file GuidelineProjectorConstantT.cpp.

25{
26 QPointF posGraphBL, posGraphTL, posGraphTR, posGraphBR;
27 calculateCorners (transformation,
28 sceneRect,
29 posGraphBL,
30 posGraphTL,
31 posGraphTR,
32 posGraphBR);
33
34 // These containers would be QVector2D to emphasize we are not working with x and y valuees, but
35 // QVector2D would give double/float conversion errors
36 QPointF anglesLeft (qMin (posGraphBL.x(), posGraphTL.x()),
37 qMax (posGraphBL.x(), posGraphTL.x()));
38 QPointF anglesTop (qMin (posGraphTL.x(), posGraphTR.x()),
39 qMax (posGraphTL.x(), posGraphTR.x()));
40 QPointF anglesRight (qMin (posGraphTR.x(), posGraphBR.x()),
41 qMax (posGraphTR.x(), posGraphBR.x()));
42 QPointF anglesBottom (qMin (posGraphBR.x(), posGraphBL.x()),
43 qMax (posGraphBR.x(), posGraphBL.x()));
44
45 // Fix any side that crosses over the discontinuous transition
46 if (qAbs (anglesLeft.y() - anglesLeft.x()) > 180.0) {
47 double temp = anglesLeft.x();
48 anglesLeft.setX (anglesLeft.y());
49 anglesLeft.setY (temp + 360.0);
50 }
51 if (qAbs (anglesTop.y() - anglesTop.x()) > 180.0) {
52 double temp = anglesTop.x();
53 anglesTop.setX (anglesTop.y());
54 anglesTop.setY (temp + 360.0);
55 }
56 if (qAbs (anglesRight.y() - anglesRight.x()) > 180.0) {
57 double temp = anglesRight.x();
58 anglesRight.setX (anglesRight.y());
59 anglesRight.setY (temp + 360.0);
60 }
61 if (qAbs (anglesBottom.y() - anglesBottom.x()) > 180.0) {
62 double temp = anglesBottom.x();
63 anglesBottom.setX (anglesBottom.y());
64 anglesBottom.setY (temp + 360.0);
65 }
66
67 // Which side matches theta?
68 QLineF line;
69 double thetaGraphPlus = thetaGraphDegrees + 360.0;
70 if ((anglesLeft.x() <= thetaGraphDegrees && thetaGraphDegrees <= anglesLeft.y()) ||
71 (anglesLeft.x() <= thetaGraphPlus && thetaGraphPlus <= anglesLeft.y())) {
72
73 // Left side
74 line = intersect (transformation,
75 thetaGraphDegrees,
76 posGraphBL,
77 posGraphTL);
78
79 } else if ((anglesTop.x() <= thetaGraphDegrees && thetaGraphDegrees <= anglesTop.y()) ||
80 (anglesTop.x() <= thetaGraphPlus && thetaGraphPlus <= anglesTop.y())) {
81
82 // Top side
83 line = intersect (transformation,
84 thetaGraphDegrees,
85 posGraphTL,
86 posGraphTR);
87
88 } else if ((anglesRight.x() <= thetaGraphDegrees && thetaGraphDegrees <= anglesRight.y()) ||
89 (anglesRight.x() <= thetaGraphPlus && thetaGraphPlus <= anglesRight.y())) {
90
91 // Right side
92 line = intersect (transformation,
93 thetaGraphDegrees,
94 posGraphTR,
95 posGraphBR);
96
97 } else {
98
99 // Bottom side
100 line = intersect (transformation,
101 thetaGraphDegrees,
102 posGraphBR,
103 posGraphBL);
104
105 }
106
107 return line;
108}
void calculateCorners(const Transformation &transformation, const QRectF &sceneRect, QPointF &posGraphBL, QPointF &posGraphTL, QPointF &posGraphTR, QPointF &posGraphBR) const
Conpute four corners of scene in graph coordinates.

◆ fromPosScreen()

QLineF GuidelineProjectorConstantT::fromPosScreen ( const Transformation & transformation,
const QRectF & sceneRect,
const QPointF & posScreen )

Return line through point in screen coordinates.

Definition at line 110 of file GuidelineProjectorConstantT.cpp.

113{
114 QPointF posGraph;
115 transformation.transformScreenToRawGraph (posScreen, posGraph);
116
117 return fromCoordinateT (transformation,
118 sceneRect,
119 posGraph.x());
120}
QLineF fromCoordinateT(const Transformation &transformation, const QRectF &sceneRect, double tGraph)
Return line through theta in graph coordinates.
void transformScreenToRawGraph(const QPointF &coordScreen, QPointF &coordGraph) const
Transform from cartesian pixel screen coordinates to cartesian/polar graph coordinates.

The documentation for this class was generated from the following files: