HGE2D-0.1.6.2: 2D game engine written in Haskell

HGE2D.Geometry

Description

Containing geometrical functions

Synopsis

# Documentation

Transform an angle in radians to an angle in degrees

Transform an angle in degrees to an angle in radians

Calculate angle in radians between two positions in space, from the first to the secind

Calculate angle of a velocity

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

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)

Builder for a rigidbody

Builder to get a BoundingBox from its center position and sizes

Calculates the size of a BoundingBox

Calculates the center of a BoundingBox

Merges two bounding boxes, creating a new one which wraps around the inputs

Builds a BoundingBox

Given a position, time and veilocty it calculates the position where the moving object would be