|
|
@ -4,6 +4,7 @@ module Maths |
|
|
|
unitVector, |
|
|
|
unitVector, |
|
|
|
randV3, |
|
|
|
randV3, |
|
|
|
rand, |
|
|
|
rand, |
|
|
|
|
|
|
|
randRange, |
|
|
|
reflect, |
|
|
|
reflect, |
|
|
|
refract, |
|
|
|
refract, |
|
|
|
reflectance, |
|
|
|
reflectance, |
|
|
@ -19,6 +20,9 @@ import System.Random |
|
|
|
rand :: (RandomGen g) => Rand g Double |
|
|
|
rand :: (RandomGen g) => Rand g Double |
|
|
|
rand = getRandomR (-1.0, 1.0 :: Double) |
|
|
|
rand = getRandomR (-1.0, 1.0 :: Double) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
randRange :: (RandomGen g) => Double -> Double -> Rand g Double |
|
|
|
|
|
|
|
randRange a b = getRandomR (a, b :: Double) |
|
|
|
|
|
|
|
|
|
|
|
randV3 :: (RandomGen g) => Rand g (V3 Double) |
|
|
|
randV3 :: (RandomGen g) => Rand g (V3 Double) |
|
|
|
randV3 = do |
|
|
|
randV3 = do |
|
|
|
x <- rand |
|
|
|
x <- rand |
|
|
|