-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpoint.cpp
More file actions
64 lines (59 loc) · 1.77 KB
/
Copy pathpoint.cpp
File metadata and controls
64 lines (59 loc) · 1.77 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
#ifndef POINT_PAPP_VARGA_H
#define POINT_PAPP_VARGA_H
#include <Eigen/Core>
template<typename RealScalar>
struct Point{
using Vector = Eigen::Vector<RealScalar, Eigen::Dynamic>;
// should be private probably but whatever
Vector x, y, z, s;
RealScalar kap, tau, theta;
Point<RealScalar>& operator+=(const Point<RealScalar>& other);
friend Point<RealScalar> operator+(Point<RealScalar> lhs, Point<RealScalar>& other){
lhs += other;
return lhs;
}
Point<RealScalar>& operator-=(const Point<RealScalar>& other);
friend Point<RealScalar> operator-(Point<RealScalar> lhs, Point<RealScalar>& other){
lhs -= other;
return lhs;
}
Point<RealScalar>& operator/=(const RealScalar& other);
friend Point<RealScalar> operator/(Point<RealScalar> lhs, RealScalar& other){
lhs /= other;
return lhs;
}
};
template<typename RealScalar>
Point<RealScalar>& Point<RealScalar>::operator+=(const Point<RealScalar>& other){
this->x += other.x;
this->y += other.y;
this->z += other.z;
this->s += other.s;
this->kap += other.kap;
this->tau += other.tau;
this->theta += other.theta;
return *this;
}
template<typename RealScalar>
Point<RealScalar>& Point<RealScalar>::operator-=(const Point<RealScalar>& other){
this->x -= other.x;
this->y -= other.y;
this->z -= other.z;
this->s -= other.s;
this->kap -= other.kap;
this->tau -= other.tau;
this->theta -= other.theta;
return *this;
}
template<typename RealScalar>
Point<RealScalar>& Point<RealScalar>::operator/=(const RealScalar& other){
this->x /= other;
this->y /= other;
this->z /= other;
this->s /= other;
this->kap /= other;
this->tau /= other;
this->theta /= other;
return *this;
}
#endif