Engauge Digitizer 2
Loading...
Searching...
No Matches
SplinePair.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 "SplinePair.h"
8
9using namespace std;
10
12 m_x (0.0),
13 m_y (0.0)
14{
15}
16
17SplinePair::SplinePair (double scalar) :
18 m_x (scalar),
19 m_y (scalar)
20{
21}
22
24 double y) :
25 m_x (x),
26 m_y (y)
27{
28}
29
31{
32 m_x = other.x();
33 m_y = other.y();
34
35 return *this;
36}
37
39 m_x (other.x()),
40 m_y (other.y())
41{
42}
43
45{
46 SplinePair result (m_x + other.x(),
47 m_y + other.y());
48
49 return result;
50}
51
53{
54 SplinePair result (m_x - other.x(),
55 m_y - other.y());
56
57 return result;
58}
59
61{
62 SplinePair result (m_x * other.x(),
63 m_y * other.y());
64
65 return result;
66}
67
69{
70 SplinePair result (m_x / other.x(),
71 m_y / other.y());
72
73 return result;
74}
75
76ostream &operator<< (ostream &str, const SplinePair &pair)
77{
78 str << "(" << pair.x() << "," << pair.y() << ")";
79
80 return str;
81}
82
83double SplinePair::x() const
84{
85 return m_x;
86}
87
88double SplinePair::y() const
89{
90 return m_y;
91}
ostream & operator<<(ostream &str, const SplinePair &pair)
Single X/Y pair for cubic spline interpolation initialization and calculations.
Definition SplinePair.h:14
double y() const
Get method for y.
double x() const
Get method for x.
SplinePair operator-(const SplinePair &other) const
Subtraction operator.
SplinePair()
Default constructor. Normally used only by generic container classes.
SplinePair operator/(const SplinePair &other) const
Division operator.
SplinePair operator*(const SplinePair &other) const
Multiplication operator.
SplinePair operator+(const SplinePair &other) const
Addition operator.
SplinePair & operator=(const SplinePair &other)
Assignment constructor.