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

Data.SG.Geometry.ThreeDim

Description

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.

Synopsis

# Documentation

newtype Point3' a Source

A point in 3D space.

Constructors

 Point3 (a, a, a)

Instances

 Functor Point3' Applicative Point3' Foldable Point3' Traversable Point3' VectorNum Point3' Coord3 Point3' Coord2 Point3' Coord Point3' IsomorphicVectors Triple Point3' IsomorphicVectors Rel3' Point3' IsomorphicVectors Point3' Triple IsomorphicVectors Point3' Rel3' Geometry Rel3' Point3' Line3' Eq a => Eq (Point3' a) Ord a => Ord (Point3' a) Read a => Read (Point3' a) Show a => Show (Point3' a)

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```

Constructors

 Rel3 (a, a, a) a

Instances

 Foldable Rel3' VectorNum Rel3' Coord3 Rel3' Coord2 Rel3' Coord Rel3' IsomorphicVectors Triple Rel3' IsomorphicVectors Rel3' Triple IsomorphicVectors Rel3' Point3' IsomorphicVectors Point3' Rel3' Geometry Rel3' Point3' Line3' Eq a => Eq (Rel3' a) (Show a, Eq a, Num a) => Num (Rel3' a) Ord a => Ord (Rel3' a) Read a => Read (Rel3' a) Show a => Show (Rel3' 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).

Constructors

 Line3 FieldsgetLineStart3 :: Point3' a getLineDir3 :: Rel3' a

Instances

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