aboutsummaryrefslogtreecommitdiffstats
path: root/tests/libsample/point.h
blob: e5ec9c1bc2764d919165861551103e71861f7144 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#ifndef POINT_H
#define POINT_H

#include "complex.h"
#include <utility>

class Point
{
public:
    Point(int x = 0, int y = 0);
    Point(double x, double y);
    ~Point() {}

    double x() const { return m_x; }
    double y() const { return m_y; }

    bool operator==(const Point& other);
    Point operator+(const Point& other);
    Point operator-(const Point& other);

    friend Point operator*(Point& pt, double mult);
    friend Point operator*(Point& pt, int mult);
    friend Point operator*(double mult, Point& pt);
    friend Point operator*(int mult, Point& pt);
    friend Point operator-(const Point& pt);
    friend bool operator!(const Point& pt);

    Point& operator+=(Point &other);
    Point& operator-=(Point &other);

    void show();

private:
    double m_x;
    double m_y;
};

Point operator*(Point& pt, double mult);
Point operator*(Point& pt, int mult);
Point operator*(double mult, Point& pt);
Point operator*(int mult, Point& pt);
Point operator-(const Point& pt);
bool operator!(const Point& pt);

Complex transmutePointIntoComplex(Point point);
Point transmuteComplexIntoPoint(Complex cpx);

Point operator*(Point& pt, double multiplier);

#endif // POINT_H