Skip to content

Commit

Permalink
add Vector sum function
Browse files Browse the repository at this point in the history
  • Loading branch information
futu2 committed Oct 16, 2023
1 parent e48056e commit 64619c1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Raylib/Util/Math.hs
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,10 @@ class Vector a where
-- | Max value for each pair of components
vectorMax :: a -> a -> a
vectorMax v1 v2 = fromList $ zipWith max (asList v1) (asList v2)

-- | sum of vectors
vectorSum :: Foldable t => t a -> a
vectorSum = foldl' (|+|) zero

instance Vector Vector2 where
asList (Vector2 x y) = [x, y]
Expand Down

0 comments on commit 64619c1

Please sign in to comment.