Guest User

Untitled

a guest
Aug 11th, 2016
27
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.23 KB | None | 0 0
  1.         u1 = math.random()
  2.         u2 = math.random()
  3.         u3 = math.random()
  4.         u4 = math.random()
  5.         q0 = math.sqrt(-2 * math.log(u1)) * math.cos(2 * math.pi * u2)
  6.         q1 = math.sqrt(-2 * math.log(u1)) * math.sin(2 * math.pi * u2)
  7.         q2 = math.sqrt(-2 * math.log(u3)) * math.cos(2 * math.pi * u4)
  8.         q3 = math.sqrt(-2 * math.log(u3)) * math.sin(2 * math.pi * u4)
  9.         --xr = math.atan(  (2*(q0*q1+q2*q3)) / (1-2*(q1^2+q2^2))  )
  10.         --yr = math.asin(  2*(q0*q2 - q3*q1)  )
  11.         --zr = math.atan(  (2*(q0*q3+q1*q2)) / (1-2*(q2^2+q3^2))  )
  12.         --xr = math.atan2(2*(q0*q1+q2*q3), 1-2*(q1^2+q2^2))
  13.         --yr = math.asin(2*(q0*q2-q3*q1))
  14.         --zr = math.atan2(2*(q0*q3+q1*q2), 1-2*(q2^2+q3^2))
  15.         xr = math.atan2(  (2*(q0*q1+q2*q3)) , (1-2*(q1^2+q2^2))  )
  16.         yr = math.asin(  2*(q0*q2 - q3*q1)  )
  17.         zr = math.atan2(  (2*(q0*q3+q1*q2)) , (1-2*(q2^2+q3^2)) )
  18.  
  19.         --u = math.random()
  20.         --v = math.random()
  21.         --theta = 2 * math.pi * u
  22.         --phi = math.acos(2*v-1)
  23.         --xr = theta*(360/(2*math.pi))
  24.         --yr = 0
  25.         --zr = phi*(360/(2*math.pi))
  26.             rotation = {math.deg(xr), math.deg(yr), math.deg(zr)},
  27.             --rotation = {xr, yr, zr}
Advertisement
Add Comment
Please, Sign In to add comment