Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- u1 = math.random()
- u2 = math.random()
- u3 = math.random()
- u4 = math.random()
- q0 = math.sqrt(-2 * math.log(u1)) * math.cos(2 * math.pi * u2)
- q1 = math.sqrt(-2 * math.log(u1)) * math.sin(2 * math.pi * u2)
- q2 = math.sqrt(-2 * math.log(u3)) * math.cos(2 * math.pi * u4)
- q3 = math.sqrt(-2 * math.log(u3)) * math.sin(2 * math.pi * u4)
- --xr = math.atan( (2*(q0*q1+q2*q3)) / (1-2*(q1^2+q2^2)) )
- --yr = math.asin( 2*(q0*q2 - q3*q1) )
- --zr = math.atan( (2*(q0*q3+q1*q2)) / (1-2*(q2^2+q3^2)) )
- --xr = math.atan2(2*(q0*q1+q2*q3), 1-2*(q1^2+q2^2))
- --yr = math.asin(2*(q0*q2-q3*q1))
- --zr = math.atan2(2*(q0*q3+q1*q2), 1-2*(q2^2+q3^2))
- xr = math.atan2( (2*(q0*q1+q2*q3)) , (1-2*(q1^2+q2^2)) )
- yr = math.asin( 2*(q0*q2 - q3*q1) )
- zr = math.atan2( (2*(q0*q3+q1*q2)) , (1-2*(q2^2+q3^2)) )
- --u = math.random()
- --v = math.random()
- --theta = 2 * math.pi * u
- --phi = math.acos(2*v-1)
- --xr = theta*(360/(2*math.pi))
- --yr = 0
- --zr = phi*(360/(2*math.pi))
- rotation = {math.deg(xr), math.deg(yr), math.deg(zr)},
- --rotation = {xr, yr, zr}
Advertisement
Add Comment
Please, Sign In to add comment