-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Efficient geometric vectors and transformations.
--
-- This Haskell library implements several small vectors types with
-- Double fields, with seperate types for each size of vector,
-- and a type class for handling vectors generally. (Note that although
-- this package is listed in the "graphics" category, the package itself
-- has no graphics facilities. It just contains data structures that are
-- useful for graphics work.)
@package AC-Vector
@version 2.4.0
-- | General functions applicable to all vector types.
module Data.Vector.Class
-- | The type of vector field values.
type Scalar = Double
-- | All vector types belong to this class. Aside from vpack and
-- vunpack, these methods aren't especially useful to end-users;
-- they're used internally by the vector arithmetic implementations.
class BasicVector v
-- | Apply a function to all vector fields.
vmap :: BasicVector v => (Scalar -> Scalar) -> v -> v
-- | Zip two vectors together field-by-field using the supplied function
-- (in the style of Data.List.zipWith).
vzip :: BasicVector v => (Scalar -> Scalar -> Scalar) -> v -> v -> v
-- | Reduce a vector down to a single value using the supplied binary
-- operator. The ordering in which this happens isn't guaranteed, so the
-- operator should probably be associative and commutative.
vfold :: BasicVector v => (Scalar -> Scalar -> Scalar) -> v -> Scalar
-- | Pack a list of values into a vector. Extra values are ignored, too few
-- values yields Nothing.
vpack :: BasicVector v => [Scalar] -> Maybe v
-- | Unpack a vector into a list of values. (Always succeeds.)
vunpack :: BasicVector v => v -> [Scalar]
-- | Convert a Scalar to a vector (with all components the same).
vpromote :: BasicVector v => Scalar -> v
-- | Dummy class that enables you to request a vector in a type signature
-- without needing to explicitly list Num or Fractional as
-- well.
class (BasicVector v, Num v, Fractional v) => Vector v
-- | Scale a vector (i.e., change its length but not its direction). This
-- operator has the same precedence as the usual (*) operator.
--
-- The (*|) and (|*) operators are identical, but with
-- their argument flipped. Just remember that the '|' denotes
-- the scalar part.
(*|) :: Vector v => Scalar -> v -> v
infixl 7 *|
-- | Scale a vector (i.e., change its length but not its direction). This
-- operator has the same precedence as the usual (*) operator.
--
-- The (*|) and (|*) operators are identical, but with
-- their argument flipped. Just remember that the '|' denotes
-- the scalar part.
(|*) :: Vector v => v -> Scalar -> v
infixl 7 |*
-- | Scale a vector (i.e., change its length but not its direction). This
-- operator has the same precedence as the usual (/) operator.
--
-- The (/|) and (|/) operators are identical, but with
-- their argument flipped. Just remember that the '|' denotes
-- the scalar part.
(|/) :: Vector v => v -> Scalar -> v
infixl 7 |/
-- | Scale a vector (i.e., change its length but not its direction). This
-- operator has the same precedence as the usual (/) operator.
--
-- The (/|) and (|/) operators are identical, but with
-- their argument flipped. Just remember that the '|' denotes
-- the scalar part.
(/|) :: Vector v => Scalar -> v -> v
infixl 7 /|
-- | Take the dot product of two vectors. This is a scalar equal to
-- the cosine of the angle between the two vectors multiplied by the
-- length of each vectors.
vdot :: Vector v => v -> v -> Scalar
-- | Return the length or magnitude of a vector. (Note that this
-- involves a slow square root operation.)
vmag :: Vector v => v -> Scalar
-- | Normalise a vector. In order words, return a new vector with the same
-- direction, but a length of exactly one. (If the vector's length is
-- zero or very near to zero, the vector is returned unchanged.)
vnormalise :: Vector v => v -> v
-- | Linearly interpolate between two points in space.
--
--
-- vlinear 0 a b = a
-- vlinear 1 a b = b
-- - vlinear 0.5 a b would give a point exactly half way
-- between a and b in a straight line.
--
vlinear :: Vector v => Scalar -> v -> v -> v
-- | This module provides the Range type and several functions for
-- working with ranges.
module Data.BoundingBox.Range
-- | A Range represents a continuous interval between two
-- Scalar endpoints.
data Range
Range :: {-# UNPACK #-} !Scalar -> Range
[min_point, max_point] :: Range -> {-# UNPACK #-} !Scalar
-- | Given two Scalars, construct a Range (swapping the
-- endpoints if necessary so that they are in the correct order.
bound_corners :: Scalar -> Scalar -> Range
-- | Find the bounds of a list of points. (Throws an exception if the list
-- is empty.)
bound_points :: [Scalar] -> Range
-- | Test whether a given Scalar falls within a particular
-- Range.
within_bounds :: Scalar -> Range -> Bool
-- | Take the union of two ranges. The resulting Range contains all
-- points that the original ranges contained, plus any points between
-- them (if the original ranges don't overlap).
union :: Range -> Range -> Range
-- | Take the intersection of two ranges. If the ranges do not overlap, the
-- intersection is empty, and Nothing is returned. (This is a good
-- way to check whether two ranges overlap or not.) Otherwise a new
-- Range is returned that contains only the points common to both
-- ranges.
isect :: Range -> Range -> Maybe Range
-- | Efficiently compute the union of a list of ranges.
unions :: [Range] -> Range
instance GHC.Show.Show Data.BoundingBox.Range.Range
instance GHC.Classes.Eq Data.BoundingBox.Range.Range
-- | 1-dimensional vectors with vector arithmetic.
--
-- This isn't especially useful. Usually if you want to calculate with
-- scalars, you can just use the Scalar type directly. However,
-- this module provides a Vector1 newtype over Scalar that
-- allows a scalar to be treated as a sort of vector, which is very
-- occasionally useful.
module Data.Vector.V1
-- | The type of 1D vectors.
--
-- Owing to its particularly simple structure, this type has more class
-- instances than 'propper' vectors have. Still, for the most part you'll
-- probably want to just use Scalar itself directly.
newtype Vector1
Vector1 :: Scalar -> Vector1
[v1x] :: Vector1 -> Scalar
instance GHC.Real.Fractional Data.Vector.V1.Vector1
instance GHC.Num.Num Data.Vector.V1.Vector1
instance GHC.Show.Show Data.Vector.V1.Vector1
instance GHC.Enum.Enum Data.Vector.V1.Vector1
instance GHC.Classes.Ord Data.Vector.V1.Vector1
instance GHC.Classes.Eq Data.Vector.V1.Vector1
instance Data.Vector.Class.BasicVector Data.Vector.V1.Vector1
instance Data.Vector.Class.Vector Data.Vector.V1.Vector1
-- | 1-dimensional linear transformations.
module Data.Vector.Transform.T1
-- | The type of 1D linear transformations. Essentially, this is applying a
-- linear function to a number.
--
-- Note the Monoid instance, which gives you access to the
-- identity transform (mempty) and the ability to combine a
-- series of transforms into a single transform (mappend).
data Transform1
Transform1 :: {-# UNPACK #-} !Scalar -> Transform1
[t1_XX, t1_1X] :: Transform1 -> {-# UNPACK #-} !Scalar
-- | Apply a 1D transformation to a 1D point, yielding a new 1D point.
transformP1 :: Transform1 -> Vector1 -> Vector1
instance GHC.Show.Show Data.Vector.Transform.T1.Transform1
instance GHC.Classes.Eq Data.Vector.Transform.T1.Transform1
instance GHC.Base.Monoid Data.Vector.Transform.T1.Transform1
instance GHC.Base.Semigroup Data.Vector.Transform.T1.Transform1
-- | This module provides the BBox1 type (mainly for completeness).
module Data.BoundingBox.B1
-- | The BBox1 type is basically a Range, but all the
-- operations over it work with Vector1 (which is really
-- Scalar). While it's called a bounding box, a
-- 1-dimensional box is in truth a simple line interval, just like
-- Range.
newtype BBox1
BBox1 :: Range -> BBox1
[range] :: BBox1 -> Range
-- | Given two vectors, construct a bounding box (swapping the endpoints if
-- necessary).
bound_corners :: Vector1 -> Vector1 -> BBox1
-- | Find the bounds of a list of points. (Throws an exception if the list
-- is empty.)
bound_points :: [Vector1] -> BBox1
-- | Test whether a Vector1 lies within a BBox1.
within_bounds :: Vector1 -> BBox1 -> Bool
-- | Return the minimum endpoint for a BBox1.
min_point :: BBox1 -> Vector1
-- | Return the maximum endpoint for a BBox1.
max_point :: BBox1 -> Vector1
-- | Take the union of two BBox1 values. The result is a new
-- BBox1 that contains all the points the original boxes
-- contained, plus any extra space between them.
union :: BBox1 -> BBox1 -> BBox1
-- | Take the intersection of two BBox1 values. If the boxes do not
-- overlap, return Nothing. Otherwise return a BBox1
-- containing only the points common to both argument boxes.
isect :: BBox1 -> BBox1 -> Maybe BBox1
-- | Efficiently compute the union of a list of bounding boxes.
unions :: [BBox1] -> BBox1
instance GHC.Show.Show Data.BoundingBox.B1.BBox1
instance GHC.Classes.Eq Data.BoundingBox.B1.BBox1
-- | 2-dimensional vectors with vector arithmetic.
module Data.Vector.V2
data Vector2
Vector2 :: {-# UNPACK #-} !Scalar -> Vector2
[v2x, v2y] :: Vector2 -> {-# UNPACK #-} !Scalar
instance GHC.Show.Show Data.Vector.V2.Vector2
instance GHC.Classes.Eq Data.Vector.V2.Vector2
instance Data.Vector.Class.BasicVector Data.Vector.V2.Vector2
instance GHC.Num.Num Data.Vector.V2.Vector2
instance GHC.Real.Fractional Data.Vector.V2.Vector2
instance Data.Vector.Class.Vector Data.Vector.V2.Vector2
-- | 2-dimensional linear transformations.
module Data.Vector.Transform.T2
-- | The type of 2D linear transformations.
--
-- Note the Monoid instance, which gives you access to the
-- identity transform (mempty) and the ability to combine a
-- series of transforms into a single transform (mappend).
data Transform2
Transform2 :: {-# UNPACK #-} !Scalar -> Transform2
[t2_XX, t2_YX, t2_1X, t2_XY, t2_YY, t2_1Y] :: Transform2 -> {-# UNPACK #-} !Scalar
-- | Apply a 2D transformation to a 2D point, yielding a new 2D point.
transformP2 :: Transform2 -> Vector2 -> Vector2
instance GHC.Show.Show Data.Vector.Transform.T2.Transform2
instance GHC.Classes.Eq Data.Vector.Transform.T2.Transform2
instance GHC.Base.Monoid Data.Vector.Transform.T2.Transform2
instance GHC.Base.Semigroup Data.Vector.Transform.T2.Transform2
-- | This module provides the BBox2 type for 2-dimensional bounding
-- boxes.
module Data.BoundingBox.B2
-- | A BBox2 is a 2D bounding box (aligned to the coordinate axies).
data BBox2
BBox2 :: {-# UNPACK #-} !Scalar -> BBox2
[minX, minY, maxX, maxY] :: BBox2 -> {-# UNPACK #-} !Scalar
-- | Return the X-range that this bounding box covers.
rangeX :: BBox2 -> Range
-- | Return the Y-range that this bounding box covers.
rangeY :: BBox2 -> Range
-- | Given ranges for each coordinate axis, construct a bounding box.
rangeXY :: Range -> Range -> BBox2
-- | Given a pair of corner points, construct a bounding box. (The points
-- must be from opposite corners, but it doesn't matter which
-- corners nor which order they are given in.)
bound_corners :: Vector2 -> Vector2 -> BBox2
-- | Find the bounds of a list of points. (Throws an exception if the list
-- is empty.)
bound_points :: [Vector2] -> BBox2
-- | Test whether a given 2D vector is inside this bounding box.
within_bounds :: Vector2 -> BBox2 -> Bool
-- | Return the minimum values for both coordinates. (In usual 2D space,
-- the bottom-left corner point.)
min_point :: BBox2 -> Vector2
-- | Return the maximum values for both coordinates. (In usual 2D space,
-- the top-right corner point.)
max_point :: BBox2 -> Vector2
-- | Take the union of two bounding boxes. The result is a new bounding box
-- that contains all the points the original boxes contained, plus any
-- extra space between them.
union :: BBox2 -> BBox2 -> BBox2
-- | Take the intersection of two bounding boxes. If the boxes do not
-- overlap, return Nothing. Otherwise return a new bounding box
-- containing only the points common to both argument boxes.
isect :: BBox2 -> BBox2 -> Maybe BBox2
-- | Efficiently compute the union of a list of bounding boxes.
unions :: [BBox2] -> BBox2
instance GHC.Show.Show Data.BoundingBox.B2.BBox2
instance GHC.Classes.Eq Data.BoundingBox.B2.BBox2
-- | 3-dimensional vectors with vector arithmetic.
module Data.Vector.V3
data Vector3
Vector3 :: {-# UNPACK #-} !Scalar -> Vector3
[v3x, v3y, v3z] :: Vector3 -> {-# UNPACK #-} !Scalar
-- | Take the cross product of two 3D vectors. This produces a new
-- 3D vector that is perpendicular to the plane of the first two vectors,
-- and who's length is equal to the sine of the angle between those
-- vectors multiplied by their lengths.
--
-- Note that a `vcross` b = negate (b `vcross` a).
vcross :: Vector3 -> Vector3 -> Vector3
instance GHC.Show.Show Data.Vector.V3.Vector3
instance GHC.Classes.Eq Data.Vector.V3.Vector3
instance Data.Vector.Class.BasicVector Data.Vector.V3.Vector3
instance GHC.Num.Num Data.Vector.V3.Vector3
instance GHC.Real.Fractional Data.Vector.V3.Vector3
instance Data.Vector.Class.Vector Data.Vector.V3.Vector3
-- | 3-dimensional linear transformations.
module Data.Vector.Transform.T3
-- | The type of 3D linear transformations.
--
-- Note the Monoid instance, which gives you access to the
-- identity transform (mempty) and the ability to combine a
-- series of transforms into a single transform (mappend).
data Transform3
Transform3 :: {-# UNPACK #-} !Scalar -> Transform3
[t3_XX, t3_YX, t3_ZX, t3_1X, t3_XY, t3_YY, t3_ZY, t3_1Y, t3_XZ, t3_YZ, t3_ZZ, t3_1Z] :: Transform3 -> {-# UNPACK #-} !Scalar
-- | Apply a 3D transformation to a 3D point, yielding a new 3D point.
transformP3 :: Transform3 -> Vector3 -> Vector3
instance GHC.Show.Show Data.Vector.Transform.T3.Transform3
instance GHC.Classes.Eq Data.Vector.Transform.T3.Transform3
instance GHC.Base.Monoid Data.Vector.Transform.T3.Transform3
instance GHC.Base.Semigroup Data.Vector.Transform.T3.Transform3
-- | This module provides the BBox3 type for 3-dimensional bounding
-- boxes ("bounding volumes").
module Data.BoundingBox.B3
-- | A BBox3 is a 3D bounding box (aligned to the coordinate axies).
data BBox3
BBox3 :: {-# UNPACK #-} !Scalar -> BBox3
[minX, minY, minZ, maxX, maxY, maxZ] :: BBox3 -> {-# UNPACK #-} !Scalar
-- | Return the X-range that this bounding box covers.
rangeX :: BBox3 -> Range
-- | Return the Y-range that this bounding box covers.
rangeY :: BBox3 -> Range
-- | Return the Z-range that this bounding box covers.
rangeZ :: BBox3 -> Range
-- | Given ranges for each coordinate axis, construct a bounding box.
rangeXYZ :: Range -> Range -> Range -> BBox3
-- | Given a pair of corner points, construct a bounding box. (The points
-- must be from opposite corners, but it doesn't matter which
-- corners nor which order they are given in.)
bound_corners :: Vector3 -> Vector3 -> BBox3
-- | Find the bounds of a list of points. (Throws an exception if the list
-- is empty.)
bound_points :: [Vector3] -> BBox3
-- | Test whether a given 3D vector is inside this bounding box.
within_bounds :: Vector3 -> BBox3 -> Bool
-- | Return the minimum values for all coordinates.
min_point :: BBox3 -> Vector3
-- | Return the maximum values for all coordinates.
max_point :: BBox3 -> Vector3
-- | Take the union of two bounding boxes. The result is a new bounding box
-- that contains all the points the original boxes contained, plus any
-- extra space between them.
union :: BBox3 -> BBox3 -> BBox3
-- | Take the intersection of two bounding boxes. If the boxes do not
-- overlap, return Nothing. Otherwise return a new bounding box
-- containing only the points common to both argument boxes.
isect :: BBox3 -> BBox3 -> Maybe BBox3
-- | Efficiently compute the union of a list of bounding boxes.
unions :: [BBox3] -> BBox3
instance GHC.Show.Show Data.BoundingBox.B3.BBox3
instance GHC.Classes.Eq Data.BoundingBox.B3.BBox3
-- | 4-dimensional vectors with vector arithmetic.
module Data.Vector.V4
data Vector4
Vector4 :: {-# UNPACK #-} !Scalar -> Vector4
[v4x, v4y, v4z, v4w] :: Vector4 -> {-# UNPACK #-} !Scalar
instance GHC.Show.Show Data.Vector.V4.Vector4
instance GHC.Classes.Eq Data.Vector.V4.Vector4
instance Data.Vector.Class.BasicVector Data.Vector.V4.Vector4
instance GHC.Num.Num Data.Vector.V4.Vector4
instance GHC.Real.Fractional Data.Vector.V4.Vector4
instance Data.Vector.Class.Vector Data.Vector.V4.Vector4
-- | 4-dimensional linear transformations.
module Data.Vector.Transform.T4
-- | The type of 4D linear transformations.
--
-- Note the Monoid instance, which gives you access to the
-- identity transform (mempty) and the ability to combine a
-- series of transforms into a single transform (mappend).
data Transform4
Transform4 :: {-# UNPACK #-} !Scalar -> Transform4
[t4_XX, t4_YX, t4_ZX, t4_WX, t4_1X, t4_XY, t4_YY, t4_ZY, t4_WY, t4_1Y, t4_XZ, t4_YZ, t4_ZZ, t4_WZ, t4_1Z, t4_XW, t4_YW, t4_ZW, t4_WW, t4_1W] :: Transform4 -> {-# UNPACK #-} !Scalar
-- | Apply a 4D transformation to a 4D point, yielding a new 4D point.
transformP4 :: Transform4 -> Vector4 -> Vector4
instance GHC.Show.Show Data.Vector.Transform.T4.Transform4
instance GHC.Classes.Eq Data.Vector.Transform.T4.Transform4
instance GHC.Base.Monoid Data.Vector.Transform.T4.Transform4
instance GHC.Base.Semigroup Data.Vector.Transform.T4.Transform4
-- | This module provides the BBox4 type for 4-dimensional bounding
-- boxes (bounding hyper-volumes).
module Data.BoundingBox.B4
-- | A BBox4 is a 4D bounding box (aligned to the coordinate axies).
data BBox4
BBox4 :: {-# UNPACK #-} !Scalar -> BBox4
[minX, minY, minZ, minW, maxX, maxY, maxZ, maxW] :: BBox4 -> {-# UNPACK #-} !Scalar
-- | Return the X-range that this bounding box covers.
rangeX :: BBox4 -> Range
-- | Return the Y-range that this bounding box covers.
rangeY :: BBox4 -> Range
-- | Return the Z-range that this bounding box covers.
rangeZ :: BBox4 -> Range
-- | Return the W-range (4th coordinate) that this bounding box covers.
rangeW :: BBox4 -> Range
-- | Given ranges for each coordinate axis, construct a bounding box.
rangeXYZW :: Range -> Range -> Range -> Range -> BBox4
-- | Given a pair of corner points, construct a bounding box. (The points
-- must be from opposite corners, but it doesn't matter which
-- corners nor which order they are given in.)
bound_corners :: Vector4 -> Vector4 -> BBox4
-- | Find the bounds of a list of points. (Throws an exception if the list
-- is empty.)
bound_points :: [Vector4] -> BBox4
-- | Test whether a given 4D vector is inside this bounding box.
within_bounds :: Vector4 -> BBox4 -> Bool
-- | Return the minimum values for all coordinates.
min_point :: BBox4 -> Vector4
-- | Return the maximum values for all coordinates.
max_point :: BBox4 -> Vector4
-- | Take the union of two bounding boxes. The result is a new bounding box
-- that contains all the points the original boxes contained, plus any
-- extra space between them.
union :: BBox4 -> BBox4 -> BBox4
-- | Take the intersection of two bounding boxes. If the boxes do not
-- overlap, return Nothing. Otherwise return a new bounding box
-- containing only the points common to both argument boxes.
isect :: BBox4 -> BBox4 -> Maybe BBox4
-- | Efficiently compute the union of a list of bounding boxes.
unions :: [BBox4] -> BBox4
instance GHC.Show.Show Data.BoundingBox.B4.BBox4
instance GHC.Classes.Eq Data.BoundingBox.B4.BBox4