-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathsegment_LMO.py
More file actions
30 lines (22 loc) · 785 Bytes
/
segment_LMO.py
File metadata and controls
30 lines (22 loc) · 785 Bytes
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
class Point:
def __init__(self, coordx=0, coordy=0):
self.coordx = coordx
self.coordy = coordy
def __str__(self):
return '[coordx : {}, coordy : {}]'.format(self.coordx, self.coordy)
def display(self):
print('Point : [coordx :', self.coordx, ', coordy :', self.coordy, ']')
p = Point(1,9)
print(p)
p.display()
class Segment:
def __init__(self, coordxorig=0, coordyorig=0, coordxextr=0, coordyextr=0):
self.orig = Point(coordxorig, coordyorig)
self.extr = Point(coordxextr, coordyextr)
def __str__(self):
return '[{} , {}]'.format(self.orig, self.extr)
def display(self):
print('Segment : ', self.orig.__str__(), ',', self.extr.__str__())
seg = Segment(1, 2, 5, 0)
print(seg)
seg.display()