-
Notifications
You must be signed in to change notification settings - Fork 0
/
vector.lua
65 lines (51 loc) · 844 Bytes
/
vector.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
61
62
63
64
-- find a path through a map
-- kurve
-- Gerade
-- Zurueck
-- nach oben
-- nach unten
vector = {}
function vector.length(self)
local l=0
for i,v in ipairs(self) do
l = l + v * v
end
return math.sqrt(l)
end
function vector.add(self,v2)
for i,v in ipairs(self) do
self[i] = v + v2[i]
end
return self
end
function vector.sub(self,v2)
for i,v in ipairs(self) do
self[i] = v - v2[i]
end
return self
end
function vector.new(...)
local v = {...}
local h = getmetatable(v)
if h == nil then
h={}
end
h.__index = vector
setmetatable(v,h)
return v
end
function vector.copy(v1)
local v1 = vector.new(unpack(v1))
return v1
end
matrix = {}
function matrix.new(dimx, dimy)
end
-- ostacle center
-- obstacle radius
-- destination position
-- safe area
tt = vector.new(1,2,3)
--[[
meta information for every function
]]