Improve debris

This commit is contained in:
2022-06-16 12:24:09 +01:00
parent fa762c7687
commit aa29e5ddf2
14 changed files with 75 additions and 50 deletions
+9 -3
View File
@@ -66,9 +66,15 @@ randProb p = do
return (p1 < p)
randInCirc :: RandomGen g => Float -> State g Point2
randInCirc maxRad = do
rad <- state $ randomR (0,maxRad)
ang <- state $ randomR (0,2*pi)
randInCirc = randInArc (2*pi)
randInArc :: RandomGen g => Float -> Float -> State g Point2
randInArc = randInArcStrip 0
randInArcStrip :: RandomGen g => Float -> Float -> Float -> State g Point2
randInArcStrip minrad maxangle maxRad = do
rad <- state $ randomR (minrad,maxRad)
ang <- state $ randomR (0,maxangle)
return $ rad *.* unitVectorAtAngle ang
randOnUnitSphere :: RandomGen g => State g Point3