forked from Alfwich/CubicEngine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Point.cpp
129 lines (107 loc) · 1.47 KB
/
Point.cpp
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#include "Point.h"
// Point 2F
Point2F::Point2F()
{
x = 0.f;
y = 0.f;
}
Point2F::Point2F( float x, float y )
{
this->x = x;
this->y = y;
}
// Point 2D
Point2D::Point2D()
{
x = 0.0;
y = 0.0;
}
Point2D::Point2D( double x, double y )
{
this->x = x;
this->y = y;
}
Point3F::Point3F()
{
x = 0.f;
y = 0.f;
z = 0.f;
}
Point3F::Point3F( float x, float y, float z )
{
this->x = x;
this->y = y;
this->z = z;
}
// Point 3D
Point3D::Point3D()
{
x = 0.0;
y = 0.0;
z = 0.0;
}
Point3D::Point3D( double x, double y, double z )
{
this->x = x;
this->y = y;
this->z = z;
}
Point3D Point3D::add( Point3D p1, Point3D p2 )
{
Point3D returnPoint( p1.x + p2.x, p1.x + p2.x, p1.z + p2.z );
return returnPoint;
}
void Point3D::equal( double x, double y, double z )
{
this->x = x;
this->y = y;
this->z = z;
}
Point3D sub( Point3D p1, Point3D p2 )
{
Point3D returnPoint( p1.x - p2.x, p1.x - p2.x, p1.z - p2.z );
return returnPoint;
}
// Point 3I
Point3I::Point3I()
{
this->x = 0;
this->y = 0;
this->z = 0;
}
Point3I::Point3I( int x, int y, int z )
{
this->x = x;
this->y = y;
this->z = z;
}
// Point 4F
Point4F::Point4F()
{
x = 0.f;
y = 0.f;
z = 0.f;
w = 0.f;
}
Point4F::Point4F( float x, float y, float z, float w )
{
this->x = x;
this->y = y;
this->z = z;
this->w = w;
}
// Point 4D
Point4D::Point4D()
{
x = 0.0;
y = 0.0;
z = 0.0;
w = 0.0;
}
Point4D::Point4D( double x, double y, double z, double w )
{
this->x = x;
this->y = y;
this->z = z;
this->w = w;
}