module Graphics.Gloss.Geometry.Angle
( degToRad
, radToDeg
, normalizeAngle )
where
degToRad :: Float -> Float
degToRad :: Float -> Float
degToRad Float
d = Float
d Float -> Float -> Float
forall a. Num a => a -> a -> a
* Float
forall a. Floating a => a
pi Float -> Float -> Float
forall a. Fractional a => a -> a -> a
/ Float
180
{-# INLINE degToRad #-}
radToDeg :: Float -> Float
radToDeg :: Float -> Float
radToDeg Float
r = Float
r Float -> Float -> Float
forall a. Num a => a -> a -> a
* Float
180 Float -> Float -> Float
forall a. Fractional a => a -> a -> a
/ Float
forall a. Floating a => a
pi
{-# INLINE radToDeg #-}
normalizeAngle :: Float -> Float
normalizeAngle :: Float -> Float
normalizeAngle Float
f = Float
f Float -> Float -> Float
forall a. Num a => a -> a -> a
- Float
2 Float -> Float -> Float
forall a. Num a => a -> a -> a
* Float
forall a. Floating a => a
pi Float -> Float -> Float
forall a. Num a => a -> a -> a
* Float -> Float
floor' (Float
f Float -> Float -> Float
forall a. Fractional a => a -> a -> a
/ (Float
2 Float -> Float -> Float
forall a. Num a => a -> a -> a
* Float
forall a. Floating a => a
pi))
where floor' :: Float -> Float
floor' :: Float -> Float
floor' Float
x = Int -> Float
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Float -> Int
forall a b. (RealFrac a, Integral b) => a -> b
floor Float
x :: Int)
{-# INLINE normalizeAngle #-}