Replaces uses of elements with toVect

This commit is contained in:
Kiana Sheibani 2024-05-06 04:36:30 -04:00
parent 598e60c2da
commit f6809697e8
Signed by: toki
GPG key ID: 6CB106C25E86A9F7
2 changed files with 3 additions and 3 deletions

View file

@ -176,7 +176,7 @@ Traversable (Point n) where
export export
Show a => Show (Point n a) where Show a => Show (Point n a) where
showPrec d (MkPoint v) = showCon d "point" $ showArg $ elements v showPrec d (MkPoint v) = showCon d "point" $ showArg $ toVect v
export export
Cast a b => Cast (Point n a) (Point n b) where Cast a b => Cast (Point n a) (Point n b) where

View file

@ -186,8 +186,8 @@ perp a b = a.x * b.y - a.y * b.x
||| Calculate the cross product of the two vectors. ||| Calculate the cross product of the two vectors.
export export
cross : Neg a => Vector 3 a -> Vector 3 a -> Vector 3 a cross : Neg a => Vector 3 a -> Vector 3 a -> Vector 3 a
cross v1 v2 = let [a, b, c] = elements v1 cross v1 v2 = let [a, b, c] = toVect v1
[x, y, z] = elements v2 [x, y, z] = toVect v2
in vector [b*z - c*y, c*x - a*z, a*y - b*x] in vector [b*z - c*y, c*x - a*z, a*y - b*x]
||| Calculate the triple product of the three vectors. ||| Calculate the triple product of the three vectors.