-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpoint3d.cpp
More file actions
67 lines (53 loc) · 1.09 KB
/
point3d.cpp
File metadata and controls
67 lines (53 loc) · 1.09 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
65
66
67
#include "point3d.h"
Point3d::Point3d()
{
_x = 0;
_y = 0;
_z = 0;
}
Point3d::~Point3d()
{
//nothing
}
Point3d& Point3d::operator= (const Point3d& rhs)
{
if(&rhs != this)
{
_x = rhs._x;
_y = rhs._y;
_z = rhs._z;
}
}
Vector3d Point3d::operator- (const Point3d& rhs)
{
Vector3d result;
result.set_vector(rhs._x, rhs._y, rhs._z,
this->_x, this->_y, this->_z);
return result;
}
Point3d Point3d::operator+ (const Point3d& rhs)
{
Point3d result;
result._x = this->_x + rhs._x;
result._y = this->_y + rhs._y;
result._z = this->_z + rhs._z;
return result;
}
Point3d Point3d::operator* (const double rhs)
{
Point3d result;
result._x = this->_x * rhs;
result._y = this->_y * rhs;
result._z = this->_z * rhs;
return result;
}
Point3d::Point3d(const float x, const float y, const float z)
{
set_point(x, y, z);
}
void Point3d::set_point(const float x, const float y, const float z)
{
_x = x;
_y = y;
_z = z;
}