Engauge Digitizer 2
Loading...
Searching...
No Matches
CallbackPointOrdinal.h
Go to the documentation of this file.
1/******************************************************************************************************
2 * (C) 2014 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#ifndef CALLBACK_POINT_ORDINAL_H
8#define CALLBACK_POINT_ORDINAL_H
9
11#include "LineStyle.h"
12#include <QPointF>
13#include <QString>
14#include "Transformation.h"
15
16class Point;
17
20{
21public:
23 CallbackPointOrdinal(const LineStyle &lineStyle,
24 const Transformation &transformation,
25 const QPointF &posScreen);
26
28 CallbackSearchReturn callback (const Point &pointStart,
29 const Point &pointStop);
30
32 double ordinal () const;
33
34private:
36
37 const LineStyle m_lineStyle;
38 const Transformation m_transformation;
39 const QPointF m_posScreen;
40
41 // Find the line segment using one or two steps:
42 // 1) If the closest point to m_posScreen is between the endpoints of a line segment, then finding the minimum point-to-line distance
43 // is sufficient to determine the closest line segment. There is no ambiguity, since only one line segment will have the
44 // minimum point-to-line distance
45 // 2) If case 1 does not apply, then there are two cases:
46 // 2a) The point is just past one terminating line segment. There is no ambiguity, since only one line segment will have the
47 // minimum point-to-line distance
48 // 2b) The point is near a vertex between two line segments. There is ambiguity with the two line segments which is resolved
49 // by comparing the minimum projected-distance-outside-line (minimum value wins)
50 bool m_haveMinimumDistanceToLine;
51 double m_minimumDistanceToLine;
52 double m_minimumProjectedDistanceOutsideLine;
53 double m_ordinal; // Valid when m_haveMinimumDistanceToLine is true
54};
55
56#endif // CALLBACK_POINT_ORDINAL_H
CallbackSearchReturn
Return values for search callback methods.
Callback for computing the ordinal for a specified point, as a function of the LineStyle and curve ge...
double ordinal() const
Computed ordinal.
CallbackSearchReturn callback(const Point &pointStart, const Point &pointStop)
Callback method.
Details for a specific Line.
Definition LineStyle.h:20
Class that represents one digitized point. The screen-to-graph coordinate transformation is always ex...
Definition Point.h:26
Affine transformation between screen and graph coordinates, based on digitized axis points.