Mid strictifying
This commit is contained in:
@@ -73,15 +73,15 @@ randOnUnitSphere :: RandomGen g => State g Point3
|
||||
randOnUnitSphere = do
|
||||
z <- state $ randomR (negate 1,1)
|
||||
longitude <- state $ randomR (0, 2*pi)
|
||||
let (x,y) = sqrt (1 - z^(2::Int)) *.* unitVectorAtAngle longitude
|
||||
return (x,y,z)
|
||||
let (V2 x y) = sqrt (1 - z^(2::Int)) *.* unitVectorAtAngle longitude
|
||||
return (V3 x y z)
|
||||
|
||||
randOnHemisphere :: RandomGen g => State g Point3
|
||||
randOnHemisphere = do
|
||||
z <- state $ randomR (0,1)
|
||||
longitude <- state $ randomR (0, 2*pi)
|
||||
let (x,y) = sqrt (1 - z^(2::Int)) *.* unitVectorAtAngle longitude
|
||||
return (x,y,z)
|
||||
let (V2 x y) = sqrt (1 - z^(2::Int)) *.* unitVectorAtAngle longitude
|
||||
return (V3 x y z)
|
||||
|
||||
randInHemisphere :: RandomGen g => State g Point3
|
||||
randInHemisphere = do
|
||||
@@ -92,7 +92,7 @@ randInHemisphere = do
|
||||
randInRect :: RandomGen g => Float -> Float -> State g Point2
|
||||
randInRect w h = do x <- state $ randomR (0,w)
|
||||
y <- state $ randomR (0,h)
|
||||
return (x,y)
|
||||
return (V2 x y)
|
||||
|
||||
maybeTakeOne :: RandomGen g => [a] -> State g (Maybe a)
|
||||
maybeTakeOne [] = return Nothing
|
||||
|
||||
Reference in New Issue
Block a user