forked from helloworldC2/VirtualRobot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlighting.py
More file actions
79 lines (56 loc) · 1.33 KB
/
lighting.py
File metadata and controls
79 lines (56 loc) · 1.33 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
68
69
70
71
72
73
74
75
76
77
78
79
class Vector2f(object):
def __init__(x,y):
self.x=x
self.y=y
class Block(object):
def __init__(x,y,width,height):
self.x = x
self.y = y
self.width = width
self.height = height
def getVertices() :
a = Vector2f(self.x, self.y)
b = new Vector2f(self.x+self.width, self.y)
c = new Vector2f(self.x+self.width, self.y+self.height)
d = new Vector2f(self.x, self.y+self.height)
return [a,b,c,d]
class Intersect(object):
def __init__(pos, d, a):
self.pos = pos
self.angle = a
self.distance = d
class Light(object):
def __init__(location, radius, red, green, blue):
self.location = location
self.prevLocation = None
self.radius= radius
self.red = red
self.green = green
self.blue = blue
self.points =[]
self.walls = []
self.angles = []
self.interactions = []
def hasMoved():
if prevLocation==null):
this.prevLocation = new Vector2f(location.x,location.y)
return True
if prevLocation.x!=location.x||prevLocation.y!=location.y):
walls.clear()
points.clear()
angles.clear()
intersects.clear()
this.prevLocation.set(self.location.x, self.location.y)
return True
walls.clear()
points.clear()
angles.clear()
return false
}
public void clear(){
walls.clear()
points.clear()
angles.clear()
intersects.clear()
}
}