LambdaHack-0.2.10: A roguelike game engine in early and active development

Safe HaskellNone

Game.LambdaHack.Common.PointXY

Description

Basic cartesian geometry operations on 2D points.

Synopsis

Documentation

type X = Int

Spacial dimension for points and vectors.

type Y = Int

Spacial dimension for points and vectors.

newtype PointXY

2D points in cartesian representation.

Constructors

PointXY (X, Y) 

fromTo :: PointXY -> PointXY -> [PointXY]

A list of all points on a straight vertical or straight horizontal line between two points. Fails if no such line exists.

sortPointXY :: (PointXY, PointXY) -> (PointXY, PointXY)

Sort the sequence of two points, in the derived lexicographic order.

blaXY :: Int -> PointXY -> PointXY -> [PointXY]

Bresenham's line algorithm generalized to arbitrary starting eps (eps value of 0 gives the standard BLA). Includes the source point and goes through the target point to infinity.