-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpoint.py
69 lines (53 loc) · 1.06 KB
/
point.py
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
"""
A point in n-dim space
"""
import numpy
class Point2D:
"""
Point in 2D space with x and y coordinatess
"""
def __init__(self, x, y):
self._x = x
self._y = y
@property
def x(self):
return self._x
@x.setter
def x(self, x):
self._x = x
@property
def y(self):
return self._y
@y.setter
def y(self, y):
self._y = y
def to_numpy_array(self):
return numpy.array([self.x, self.y])
class Point3D:
"""
Point in 3D space with x, y and z coordinatess
"""
def __init__(self, x, y, z):
self._x = x
self._y = y
self._z = z
@property
def x(self):
return self._x
@x.setter
def x(self, x):
self._x = x
@property
def y(self):
return self._y
@y.setter
def y(self, y):
self._y = y
@property
def z(self):
return self._z
@z.setter
def z(self, z):
self._z = z
def to_numpy_array(self):
return numpy.array([self.x, self.y, self.z])