SG-1.0: Small geometry library for dealing with vectors and collision detection



A module with types to use in a 3D system, and various helper functions. Several more functions are available for use in the Data.SG.Geometry module.



data Rel3' a Source

A relative vector (free vector) in 3D space. The triple is the x, y, z components, and the last item is the squared magnitude of the vector, which is stored with it to speed up various operations. It is suggested you use makeRel3 to create one of these, unless the magnitude is easily apparent, e.g. Rel3 (0, 1, 1) 2


Rel3 (a, a, a) a 

makeRel3 :: Num a => (a, a, a) -> Rel3' aSource

Constructs a Rel3' vector

data Line3' a Source

A line in 3D space. A line is a point and a free vector indicating direction. A line may be treated by a function as either finite (taking the magnitude of the free vector as the length) or infinite (ignoring the magnitude of the direction vector).




Geometry Rel3' Point3' Line3' 
Eq a => Eq (Line3' a) 
Read a => Read (Line3' a) 
Show a => Show (Line3' a)