Engauge Digitizer  2
Public Member Functions | List of all members
PointMatchTriplet Class Reference

Representation of one matched point as produced from the point match algorithm. More...

#include <PointMatchTriplet.h>

Collaboration diagram for PointMatchTriplet:
Collaboration graph

Public Member Functions

 PointMatchTriplet (int x, int y, double correlation)
 Single constructor. More...
 
bool operator< (const PointMatchTriplet &other) const
 Comparison operator for sorting lists of this class using qSort. More...
 
double correlation () const
 Get method for correlation. More...
 
QPoint point () const
 Return (x,y) coordinates as a point. More...
 
int x () const
 Get method for x coordinate. More...
 
int y () const
 Get method for y coordinate. More...
 

Detailed Description

Representation of one matched point as produced from the point match algorithm.

Definition at line 13 of file PointMatchTriplet.h.

Constructor & Destructor Documentation

◆ PointMatchTriplet()

PointMatchTriplet::PointMatchTriplet ( int  x,
int  y,
double  correlation 
)

Single constructor.

Definition at line 9 of file PointMatchTriplet.cpp.

11  :
12  m_x (x),
13  m_y (y),
14  m_correlation (correlation)
15 {
16 }
int y() const
Get method for y coordinate.
double correlation() const
Get method for correlation.
int x() const
Get method for x coordinate.

Member Function Documentation

◆ correlation()

double PointMatchTriplet::correlation ( ) const

Get method for correlation.

Definition at line 18 of file PointMatchTriplet.cpp.

19 {
20  return m_correlation;
21 }

◆ operator<()

bool PointMatchTriplet::operator< ( const PointMatchTriplet other) const

Comparison operator for sorting lists of this class using qSort.

Definition at line 23 of file PointMatchTriplet.cpp.

24 {
25  // qSort 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 }
double correlation() const
Get method for correlation.
int x() const
Get method for x coordinate.

◆ point()

QPoint PointMatchTriplet::point ( ) const

Return (x,y) coordinates as a point.

Definition at line 44 of file PointMatchTriplet.cpp.

45 {
46  return QPoint (m_x,
47  m_y);
48 }

◆ x()

int PointMatchTriplet::x ( ) const

Get method for x coordinate.

Definition at line 50 of file PointMatchTriplet.cpp.

51 {
52  return m_x;
53 }

◆ y()

int PointMatchTriplet::y ( ) const

Get method for y coordinate.

Definition at line 55 of file PointMatchTriplet.cpp.

56 {
57  return m_y;
58 }

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