Engauge Digitizer 2
Loading...
Searching...
No Matches
PointMatchTriplet.cpp
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#include "PointMatchTriplet.h"
8
10 int y,
11 double correlation) :
12 m_x (x),
13 m_y (y),
14 m_correlation (correlation)
15{
16}
17
19{
20 return m_correlation;
21}
22
24{
25 // Sorting algorithm wants to sort by ascending correlation, but we want to sort by descending correlation. We
26 // compensate by comparing correlations numerically and flipping the result
27
28 bool isLess = false;
29
30 if (m_correlation == other.correlation ()) {
31
32 // To reduce jumping around, we prefer points on the left when the correlations are equal
33 isLess = (m_x < other.x());
34
35 } else {
36
37 isLess = !(m_correlation < other.correlation ());
38
39 }
40
41 return isLess;
42}
43
45{
46 return QPoint (m_x,
47 m_y);
48}
49
51{
52 return m_x;
53}
54
56{
57 return m_y;
58}
PointMatchTriplet(int x, int y, double correlation)
Single constructor.
double correlation() const
Get method for correlation.
bool operator<(const PointMatchTriplet &other) const
Comparison operator for sorting lists of this class using sorting algorithm.
int y() const
Get method for y coordinate.
int x() const
Get method for x coordinate.
QPoint point() const
Return (x,y) coordinates as a point.