Xinqi Bao's Git
5 #include "Configurations.hh"
8 Vec3d::Vec3d(double x
, double y
, double z
) : x(x
), y(y
), z(z
) {}
9 void Vec3d::readBuffer(BufferReadBinary
& buffer
)
11 x
= buffer
.getFloat();
13 y
= buffer
.getFloat();
15 z
= buffer
.getFloat();
19 bool Vec3d::equal(const Vec3d
& v
) const
21 if (fabs(x
- v
.x
) < thr
&& fabs(y
- v
.y
) < thr
&& fabs(z
- v
.z
) < thr
)
25 bool Vec3d::equal(const Vec3d
* v
) const { return equal(*v
); }
26 double Vec3d::sum() const { return x
+ y
+ z
; }
28 std::istream
& operator>>(std::istream
& s
, Vec3d
& v
)
30 return s
>> v
.x
>> v
.y
>> v
.z
;
32 std::istream
& operator>>(std::istream
& s
, Vec3d
* v
)
34 return s
>> v
->x
>> v
->y
>> v
->z
;
36 std::ostream
& operator<<(std::ostream
& s
, const Vec3d
& v
)
38 return s
<< v
.x
<< "," << v
.y
<< "," << v
.z
;
40 std::ostream
& operator<<(std::ostream
& s
, const Vec3d
* v
)
42 return s
<< v
->x
<< "," << v
->y
<< "," << v
->z
;