diff options
author | Yann Herklotz <ymherklotz@gmail.com> | 2019-02-03 13:39:23 +0000 |
---|---|---|
committer | Yann Herklotz <ymherklotz@gmail.com> | 2019-02-03 13:39:31 +0000 |
commit | dec2042515df84b0f8ebb611f925efea314da7a0 (patch) | |
tree | 906c15b4d77e4e1bb314495f28155484fba5ee61 /src/Vec.hs | |
parent | 7fb50745f7f99f8ee4491070661dbbf3f97dec19 (diff) | |
download | mirror-ball-dec2042515df84b0f8ebb611f925efea314da7a0.tar.gz mirror-ball-dec2042515df84b0f8ebb611f925efea314da7a0.zip |
Small fixes in the Vec library
Diffstat (limited to 'src/Vec.hs')
-rw-r--r-- | src/Vec.hs | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -34,7 +34,7 @@ instance Functor Sph where findZ :: (Floating a) => a -> a -> Vec a findZ x y = - Vec (x, y, sqrt (1 - x^^2 - y^^2)) + Vec (x, y, sqrt (1 - x**2 - y**2)) dot :: (Num a) => Vec a -> Vec a -> a dot (Vec (x1, y1, z1)) (Vec (x2, y2, z2)) = @@ -59,8 +59,10 @@ toSpherical (Vec (x, y, z)) Sph (acos y, pi / 2) | z == 0 = Sph (acos y, - pi / 2) + | z < 0 && x >= 0 = + Sph (acos y, pi + atan (x / z)) | z < 0 = - Sph (acos y, signum x * pi + atan (x / z)) + Sph (acos y, - pi + atan (x / z)) | otherwise = Sph (acos y, atan (x / z)) |