Performance tweaks
This commit is contained in:
@@ -83,11 +83,11 @@ rotateV r (V2 x y) = V2
|
||||
{-# INLINE rotateV #-}
|
||||
-- | Convert degrees to radians
|
||||
degToRad :: Float -> Float
|
||||
degToRad d = d * pi / 180
|
||||
degToRad d = d * pi / 180
|
||||
{-# INLINE degToRad #-}
|
||||
-- | Convert radians to degrees
|
||||
radToDeg :: Float -> Float
|
||||
radToDeg r = r * 180 / pi
|
||||
radToDeg r = r * 180 / pi
|
||||
{-# INLINE radToDeg #-}
|
||||
-- | Normalize an angle to be between 0 and 2*pi radians
|
||||
normalizeAngle :: Float -> Float
|
||||
|
||||
+12
-14
@@ -12,23 +12,21 @@ infixl 7 *.*.*
|
||||
{- | 3D coordinate-wise addition. -}
|
||||
(+.+.+) :: Point3 -> Point3 -> Point3
|
||||
{-# INLINE (+.+.+) #-}
|
||||
(+.+.+) = (+)
|
||||
--(x1, y1, z1) +.+.+ (x2, y2, z2) =
|
||||
-- let
|
||||
-- !x = x1 + x2
|
||||
-- !y = y1 + y2
|
||||
-- !z = z1 + z2
|
||||
-- in (x, y, z)
|
||||
V3 x1 y1 z1 +.+.+ V3 x2 y2 z2 =
|
||||
let
|
||||
!x = x1 + x2
|
||||
!y = y1 + y2
|
||||
!z = z1 + z2
|
||||
in V3 x y z
|
||||
{- | 3D coordinate-wise subtraction. -}
|
||||
(-.-.-) :: Point3 -> Point3 -> Point3
|
||||
{-# INLINE (-.-.-) #-}
|
||||
(-.-.-) = (-)
|
||||
--(x1, y1, z1) -.-.- (x2, y2, z2) =
|
||||
-- let
|
||||
-- !x = x1 - x2
|
||||
-- !y = y1 - y2
|
||||
-- !z = z1 - z2
|
||||
-- in (x, y, z)
|
||||
V3 x1 y1 z1 -.-.- V3 x2 y2 z2 =
|
||||
let
|
||||
!x = x1 - x2
|
||||
!y = y1 - y2
|
||||
!z = z1 - z2
|
||||
in V3 x y z
|
||||
{- | 3D scalar multiplication. -}
|
||||
(*.*.*) :: Float -> Point3 -> Point3
|
||||
{-# INLINE (*.*.*) #-}
|
||||
|
||||
Reference in New Issue
Block a user