Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- math.randomseed(694201)
- _G.gen = {
- grassHeight = 2,
- vOffset = 2,
- partCount = 5
- }
- Limits = {200, 200}
- Height = 250
- Radius = 20
- RadiusVariation = 5
- PointCount = 400
- a = 2
- k = 1
- -- Lonk 1 - 410, 60, 60, 70, 12, 3, 60, 2, 1
- _G.Points = {}
- if #Points < 1 then
- for i = 1, PointCount do
- PRadius = math.random(Radius-RadiusVariation/2, Radius+RadiusVariation/2)
- Points[i] = {math.random(PRadius, Limits[1]-PRadius),
- math.random(PRadius, Limits[2]-PRadius), PRadius}
- end
- end
- Min = 0
- Max = PointCount
- function Value(x, z)
- local OutputValue = 0
- for i, p in pairs(Points) do
- Distance = (((p[1] - x)^2 +(p[2] - z)^2)^0.5)/p[3]
- if Distance <= 1 then
- OutputValue = OutputValue + (1 - Distance)
- end
- end
- return OutputValue/Max
- end
- ValueTable = {}
- cyc = 0
- for x = 1, Limits[1] do
- ValueTable[x] = {}
- for z = 1, Limits[2] do
- cyc = cyc+1
- if cyc%10000 == 0 then sleep(0) end
- V = Value(x, z)
- ValueTable[x][z] = V
- end
- end
- _G.map = {}
- function acoth(x)
- if type(x) ~= "number" then
- error("dumbass")
- end
- return math.log((1+(1/x))/(1-(1/x)))/2
- end
- for i, x in pairs(ValueTable) do
- map[i] = {}
- for j, z in pairs(x) do
- V = math.floor(Height*(acoth( (k - z + z*math.cosh(a)) / (z * math.sinh(a)) ) / a) + 0.5)
- if V ~= V then
- print(z)
- end
- map[i][j] = V
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment