-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathVec3d.hh
34 lines (29 loc) · 830 Bytes
/
Vec3d.hh
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
#pragma once
/*
@author: Xinqi Bao
3-D vector, with 3 double vaule points.
*/
#include <iostream>
#include "BufferReadBinary.hh"
class Vec3d {
public:
double x, y, z;
void readBuffer(BufferReadBinary& buffer);
bool equal(const Vec3d& v) const;
bool equal(const Vec3d* v) const;
double sum() const;
Vec3d() {}
Vec3d(double x, double y, double z) : x(x), y(y), z(z) {}
friend std::istream& operator >>(std::istream& s, Vec3d& v) {
return s >> v.x >> v.y >> v.z;
}
friend std::istream& operator >>(std::istream& s, Vec3d* v) {
return s >> v->x >> v->y >> v->z;
}
friend std::ostream& operator <<(std::ostream& s, const Vec3d& v) {
return s << v.x << "," << v.y << "," << v.z;
}
friend std::ostream& operator <<(std::ostream& s, const Vec3d* v) {
return s << v->x << "," << v->y << "," << v->z;
}
};