mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-05 20:41:06 +00:00
69365f2a0b
git-svn-id: https://svn.eduke32.com/eduke32@2855 1a8010ca-5511-0410-912e-c29ae57300e0
41 lines
670 B
Lua
Executable file
41 lines
670 B
Lua
Executable file
#!/usr/bin/env luajit
|
|
|
|
local math = require("math")
|
|
local os = require("os")
|
|
|
|
local geom = require("geom")
|
|
|
|
|
|
local N = os.exit and tostring(arg[1]) or 1e6
|
|
|
|
local A,B = {}, {}
|
|
local V,W = {}, {}
|
|
|
|
local function randvec()
|
|
return geom.vec2(math.random(), math.random())
|
|
end
|
|
|
|
local t1 = os.clock()
|
|
|
|
-- init random points and vectors
|
|
for i=1,N do
|
|
A[i] = randvec()
|
|
B[i] = randvec()
|
|
V[i] = randvec()
|
|
W[i] = randvec()
|
|
end
|
|
|
|
local t2 = os.clock()
|
|
|
|
local v = geom.vec2(0, 0)
|
|
for i=1,N do
|
|
v = v + geom.intersect(A[i],V[i], B[i],W[i], true)
|
|
end
|
|
|
|
local t3 = os.clock()
|
|
|
|
print(1000*(t2-t1))
|
|
print(1000*(t3-t2))
|
|
print(v)
|
|
|
|
return {} -- appease Lunatic's require
|