Restructure files, add new subsystems
This commit is contained in:
27
LinearAlgebra/Vector.hs
Normal file
27
LinearAlgebra/Vector.hs
Normal file
@@ -0,0 +1,27 @@
|
||||
{-# OPTIONS_HADDOCK ignore-exports #-}
|
||||
|
||||
module LinearAlgebra.Vector where
|
||||
|
||||
import Data.Vector.Class
|
||||
|
||||
|
||||
type Angle = Double
|
||||
|
||||
|
||||
-- |Checks whether the Coordinates are in a given dimension.
|
||||
inRange :: (Double, Double) -- ^ X dimension
|
||||
-> (Double, Double) -- ^ Y dimension
|
||||
-> (Double, Double) -- ^ Coordinates
|
||||
-> Bool -- ^ result
|
||||
inRange (xlD, xuD) (ylD, yuD) (x,y)
|
||||
= x <= xuD && x >= xlD && y <= yuD && y >= ylD
|
||||
|
||||
|
||||
-- |Get the angle between two vectors in degrees.
|
||||
getAngle :: (Vector v) => v -> v -> Angle
|
||||
getAngle a b = (*) 180.0 .
|
||||
flip (/) pi .
|
||||
acos .
|
||||
flip (/) (vmag a * vmag b) .
|
||||
vdot a $
|
||||
b
|
||||
Reference in New Issue
Block a user