Copyright | (c) 2016 Martin Buck |
---|---|
License | see LICENSE |
Safe Haskell | None |
Language | Haskell2010 |
Containing geometrical functions
- rad2deg :: Double -> Double
- deg2rad :: Double -> Double
- radRealPos :: RealPosition -> RealPosition -> Radian
- velAngle :: Velocity -> Radian
- distance :: (Positioned a, Positioned b) => a -> b -> Double
- distanceSqr :: (Positioned a, Positioned b) => a -> b -> Double
- direction :: (Positioned a, Positioned b) => a -> b -> RealPosition
- closest :: (Positioned a, Positioned b) => a -> [b] -> b
- furthest :: (Positioned a, Positioned b) => a -> [b] -> b
- interceptionPos :: (RealPosition, Double) -> (RealPosition, Velocity) -> RealPosition
- makeRB :: RealPosition -> Velocity -> Pixel -> Pixel -> RigidBody
- sizedBB :: RealPosition -> Pixel -> Pixel -> BoundingBox
- sizeBB :: BoundingBox -> (Pixel, Pixel)
- centerBB :: BoundingBox -> RealPosition
- mergeBB :: BoundingBox -> BoundingBox -> BoundingBox
- makeBB :: RealPosition -> Pixel -> Pixel -> BoundingBox
- applyVelocity :: RealPosition -> Velocity -> Millisecond -> RealPosition
Documentation
radRealPos :: RealPosition -> RealPosition -> Radian Source #
Calculate angle in radians between two positions in space, from the first to the secind
distance :: (Positioned a, Positioned b) => a -> b -> Double Source #
Distance between two positions
distanceSqr :: (Positioned a, Positioned b) => a -> b -> Double Source #
Squared distance between two positions Faster than calculating the distance. Can be used to e.g. compare distances cheaply
direction :: (Positioned a, Positioned b) => a -> b -> RealPosition Source #
Calculate the direction vector between two positions
closest :: (Positioned a, Positioned b) => a -> [b] -> b Source #
Find the closest in [b] to a
furthest :: (Positioned a, Positioned b) => a -> [b] -> b Source #
Find the furthest in [b] to a
interceptionPos :: (RealPosition, Double) -> (RealPosition, Velocity) -> RealPosition Source #
Given a position and projectile speed of a gun / turret and an object defined by its current position and velocity Calculates the position where both will intercept. (useful for pre-aiming)
sizedBB :: RealPosition -> Pixel -> Pixel -> BoundingBox Source #
Builder to get a BoundingBox from its center position and sizes
centerBB :: BoundingBox -> RealPosition Source #
Calculates the center of a BoundingBox
mergeBB :: BoundingBox -> BoundingBox -> BoundingBox Source #
Merges two bounding boxes, creating a new one which wraps around the inputs
makeBB :: RealPosition -> Pixel -> Pixel -> BoundingBox Source #
Builds a BoundingBox
applyVelocity :: RealPosition -> Velocity -> Millisecond -> RealPosition Source #
Given a position, time and veilocty it calculates the position where the moving object would be