Almost working shadows
This commit is contained in:
@@ -26,13 +26,13 @@ infixl 7 *.*.*
|
||||
!z = z1 - z2
|
||||
in (x, y, z)
|
||||
{- | 3D scalar multiplication. -}
|
||||
(*.*.*) :: Point3 -> Point3 -> Point3
|
||||
(*.*.*) :: Float -> Point3 -> Point3
|
||||
{-# INLINE (*.*.*) #-}
|
||||
(x1, y1, z1) *.*.* (x2, y2, z2) =
|
||||
a *.*.* (x2, y2, z2) =
|
||||
let
|
||||
!x = x1 * x2
|
||||
!y = y1 * y2
|
||||
!z = z1 * z2
|
||||
!x = a * x2
|
||||
!y = a * y2
|
||||
!z = a * z2
|
||||
in (x, y, z)
|
||||
|
||||
crossProd :: Point3 -> Point3 -> Point3
|
||||
@@ -48,3 +48,11 @@ rotate3 a (x,y,z) = (x',y',z)
|
||||
where
|
||||
(x',y') = rotateV a (x,y)
|
||||
|
||||
magV3 :: Point3 -> Float
|
||||
magV3 (x,y,z) = sqrt $ x^i + y^i + z^i
|
||||
where
|
||||
i = 2 :: Int
|
||||
|
||||
normalizeV3 :: Point3 -> Point3
|
||||
normalizeV3 (0,0,0) = (0,0,0)
|
||||
normalizeV3 p = (1 / magV3 p) *.*.* p
|
||||
|
||||
Reference in New Issue
Block a user