mirror of
https://gitlab.com/gaelysam/mapgen_rivers.git
synced 2024-11-11 13:20:24 +01:00
Removed useless functions get_point_location and geometry.area
This commit is contained in:
parent
14163681cc
commit
43211fc31b
11
geometry.lua
11
geometry.lua
|
@ -28,18 +28,7 @@ local function transform_quadri(X, Y, x, y)
|
||||||
return xc, yc
|
return xc, yc
|
||||||
end
|
end
|
||||||
|
|
||||||
local function area(X, Y) -- Signed area of polygon, in function of direction of rotation. Clockwise = positive.
|
|
||||||
local n = #X
|
|
||||||
local sum = X[1]*Y[n] - X[n]*Y[1]
|
|
||||||
for i=2, n do
|
|
||||||
sum = sum + X[i]*Y[i-1] - X[i-1]*Y[i]
|
|
||||||
end
|
|
||||||
|
|
||||||
return sum/2
|
|
||||||
end
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
distance_to_segment = distance_to_segment,
|
distance_to_segment = distance_to_segment,
|
||||||
transform_quadri = transform_quadri,
|
transform_quadri = transform_quadri,
|
||||||
area = area,
|
|
||||||
}
|
}
|
||||||
|
|
5
init.lua
5
init.lua
|
@ -49,11 +49,6 @@ local function index(x, z)
|
||||||
return z*X+x+1
|
return z*X+x+1
|
||||||
end
|
end
|
||||||
|
|
||||||
local function get_point_location(x, z)
|
|
||||||
local i = index(x, z)
|
|
||||||
return x+offset_x[i], z+offset_z[i]
|
|
||||||
end
|
|
||||||
|
|
||||||
local function interp(v00, v01, v11, v10, xf, zf)
|
local function interp(v00, v01, v11, v10, xf, zf)
|
||||||
local v0 = v01*xf + v00*(1-xf)
|
local v0 = v01*xf + v00*(1-xf)
|
||||||
local v1 = v11*xf + v10*(1-xf)
|
local v1 = v11*xf + v10*(1-xf)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user