-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLRectangle.py
49 lines (45 loc) · 1.39 KB
/
LRectangle.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
from Shapes import Shapes
from Line import Line
import math
class LRectangle(Shapes):
def __init__(self):
self.autoDownShift = False
self.origin = []
self.point_1 = []
self.point_2 = []
self.point_3 = []
self.points = []
self.angle = math.radians(90);
self.direction = 0
self.generate()
Shapes.__init__(self,self.origin,self.points,self.angle,self.autoDownShift)
def generate(self):
line = Line();
self.origin = line.origin
self.point_1 = line.point_1
self.point_2 = line.point_2
self.direction = line.direction
_v = 1;
if self.type > 0:
_v = _v * -1;
if self.direction > 0:
#vertical alignment
if self.type > 0:
#R type
_v = _v * -1
self.point_3 = [self.point_2[0]+_v,self.point_2[1]]
else:
#horizontal alignment
if self.type > 1:
#L type
_v = _v * -1
self.point_3 = [self.point_2[0],self.point_2[1]+_v]
self.points = [self.point_1,self.origin,self.point_2,self.point_3]
class LRectangleR(LRectangle):
def __init__(self):
self.type = 0
LRectangle.__init__(self)
class LRectangleL(LRectangle):
def __init__(self):
self.type = 1
LRectangle.__init__(self)