BrineUtil

Untitled

Feb 22nd, 2021
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. math.randomseed(694201)
  2. _G.gen = {
  3. grassHeight = 2,
  4. vOffset = 2,
  5. partCount = 5
  6. }
  7. Limits = {200, 200}
  8. Height = 250
  9. Radius = 20
  10. RadiusVariation = 5
  11. PointCount = 400
  12. a = 2
  13. k = 1
  14. -- Lonk 1 - 410, 60, 60, 70, 12, 3, 60, 2, 1
  15.  
  16. _G.Points = {}
  17. if #Points < 1 then
  18. for i = 1, PointCount do
  19. PRadius = math.random(Radius-RadiusVariation/2, Radius+RadiusVariation/2)
  20. Points[i] = {math.random(PRadius, Limits[1]-PRadius),
  21. math.random(PRadius, Limits[2]-PRadius), PRadius}
  22.  
  23. end
  24. end
  25.  
  26. Min = 0
  27. Max = PointCount
  28. function Value(x, z)
  29. local OutputValue = 0
  30. for i, p in pairs(Points) do
  31. Distance = (((p[1] - x)^2 +(p[2] - z)^2)^0.5)/p[3]
  32. if Distance <= 1 then
  33. OutputValue = OutputValue + (1 - Distance)
  34. end
  35. end
  36. return OutputValue/Max
  37. end
  38.  
  39. ValueTable = {}
  40. cyc = 0
  41. for x = 1, Limits[1] do
  42. ValueTable[x] = {}
  43. for z = 1, Limits[2] do
  44. cyc = cyc+1
  45. if cyc%10000 == 0 then sleep(0) end
  46. V = Value(x, z)
  47. ValueTable[x][z] = V
  48.  
  49. end
  50.  
  51. end
  52.  
  53. _G.map = {}
  54.  
  55. function acoth(x)
  56. if type(x) ~= "number" then
  57. error("dumbass")
  58. end
  59. return math.log((1+(1/x))/(1-(1/x)))/2
  60. end
  61.  
  62. for i, x in pairs(ValueTable) do
  63. map[i] = {}
  64. for j, z in pairs(x) do
  65. V = math.floor(Height*(acoth( (k - z + z*math.cosh(a)) / (z * math.sinh(a)) ) / a) + 0.5)
  66. if V ~= V then
  67. print(z)
  68. end
  69. map[i][j] = V
  70.  
  71. end
  72.  
  73. end
  74.  
Advertisement
Add Comment
Please, Sign In to add comment