21void GuidelineProjectorConstantY::addSide (
const Transformation &transformation,
25 QList<QPointF> &intersections)
35 double num = y - p1.y();
36 double den = p2.y () - p1.y ();
40 bool okForDenPositive = (den >= 0) && (0.0 * den <= num) && (num < den);
41 bool okForDenNegative = (den < 0) && (0.0 * den >= num) && (num > 1.0 * den);
43 if (okForDenPositive || okForDenNegative) {
44 double sIntercept = num / den;
45 QPointF pIntercept ((1.0 - sIntercept) * p1 + sIntercept * p2);
50 intersections.push_back (posScreen);
55 const QRectF &sceneRect,
58 QLineF line (0, 0, 0, 0);
59 QPointF posGraphBL, posGraphTL, posGraphTR, posGraphBR;
68 QList<QPointF> intersections;
70 addSide (transformation, yGraph, posGraphBL, posGraphTL, intersections);
71 addSide (transformation, yGraph, posGraphTL, posGraphTR, intersections);
72 addSide (transformation, yGraph, posGraphTR, posGraphBR, intersections);
73 addSide (transformation, yGraph, posGraphBR, posGraphBL, intersections);
75 if (intersections.size() == 2) {
76 line = QLineF (intersections.at (0),
77 intersections.at (1));
84 const QRectF &sceneRect,
85 const QPointF &posScreen)
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.
QLineF fromCoordinateY(const Transformation &transformation, const QRectF &sceneRect, double yGraph)
Return line through y in graph coordinates.
~GuidelineProjectorConstantY()
QLineF fromPosScreen(const Transformation &transformation, const QRectF &sceneRect, const QPointF &posScreen)
Return line through point in screen coordinates.
GuidelineProjectorConstantY()
Single constructor.