-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathQuads.lua
60 lines (41 loc) · 1.02 KB
/
Quads.lua
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
-- Unused atm square shall be implemented through Rectangle and Quad through polynom
Quad = Class{}
function Quad:init(vertices)
self.v1=vertices[1]
self.v2=vertices[2]
self.v3=vertices[3]
self.width=self.v2.x-self.v1.x
self.height=self.v3.y-self.v1.y
self.v3= Vertice{self.v1.x+self.width,self.v1.y+self.height}
end
function Quad:getVertices()
return {self.v1,self.v2,self.v3,self.v4}
end
function Quad:collides(Segment)
end
function Quad:intersections(line)
local norm= line.direction:rotate90()
end
--[[
]]
function Quad:intersect(point,angle)
end
function Quad:Draw(Canvas)
end
Square= Class{}
function Square:init(vertice,size)
self.v1=vertice
self.v2=Vertice(self.v1.x+size,self.v1.y)
self.v3=Vertice(self.v1.x,self.v1.y+size)
self.v4=Vertice(self.v2.x,self.v3.y)
self.width=size
self.height=self.width
end
function Square:getVertices()
return {self.v1,self.v2,self.v3,self.v4}
end
function Square:toRectangle()
return Rectangle{self.v1,self.v2,self.v3}
end
function Square:Draw(Canvas)
end