-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Fancy type-system stuff for AC-Vector -- -- Adds various type-system tricks to AC-Vector. (Requires several -- language extensions, including type families.) Names updated to match -- AC-Vector. Gather modules are now here instead of in AC-Vector, and -- some module names have changed too for greater consistency. Added a -- new HasSpace class for generically dealing with structures of -- different dimensionallities (and updated everything else to use it). @package AC-Vector-Fancy @version 2.2.0 -- | Various facilities for dealing with vectors, vector spaces and -- coordinate axies generically. module Data.Vector.Fancy -- | This class deals with any type that has a spatial dimensionallity. -- This includes coordinate transforms, bounding boxes, and so on. -- -- Null instances are provided for all the vector types. (E.g., Point -- Vector3 = Vector3.) class HasSpace x where { type family Point x :: *; } -- | The X-axis (first axis). data AxisX AxisX :: AxisX -- | The Y-axis (second axis). data AxisY AxisY :: AxisY -- | The Z-axis (third axis). data AxisZ AxisZ :: AxisZ -- | The W-axis (fourth axis). data AxisW AxisW :: AxisW -- | Class for generically reading/writing vector coordinates. class VectorAxis vector axis get_coord :: (VectorAxis vector axis) => axis -> vector -> Scalar set_coord :: (VectorAxis vector axis) => axis -> Scalar -> vector -> vector -- | This class relates two vector types having consecutive sizes. class Project lo hi orthographic_down :: (Project lo hi) => hi -> (lo, Scalar) orthographic_up :: (Project lo hi) => (lo, Scalar) -> hi perspective_down :: (Project lo hi) => hi -> (lo, Scalar) perspective_up :: (Project lo hi) => (lo, Scalar) -> hi instance Show AxisW instance Show AxisZ instance Show AxisY instance Show AxisX instance Project Vector3 Vector4 instance Project Vector2 Vector3 instance Project Vector1 Vector2 instance VectorAxis Vector4 AxisW instance VectorAxis Vector4 AxisZ instance VectorAxis Vector3 AxisZ instance VectorAxis Vector4 AxisY instance VectorAxis Vector3 AxisY instance VectorAxis Vector2 AxisY instance VectorAxis Vector4 AxisX instance VectorAxis Vector3 AxisX instance VectorAxis Vector2 AxisX instance VectorAxis Vector1 AxisX instance HasSpace Vector4 instance HasSpace Vector3 instance HasSpace Vector2 instance HasSpace Vector1 -- | Generically handle transforms, and things that are transformable. module Data.Vector.Transform.Fancy -- | Class for transforms. class (HasSpace t) => Transform t transformP :: (Transform t) => t -> Point t -> Point t translateT :: (Transform t) => Point t -> t scaleT :: (Transform t) => Point t -> t scaleT_ :: (Transform t) => Scalar -> t -- | Class for performing rotationes. (The rotations that exist vary with -- the number of spatial dimensions available.) class (Transform t) => Rotate t axis1 axis2 rotateT :: (Rotate t axis1 axis2, Angle a) => axis1 -> axis2 -> a Scalar -> t -- | Class for things that can be transformed. Includes instances for all -- the vector types. class (HasSpace x) => Transformable x transform :: (Transformable x, Transform t, (Point t) ~ (Point x)) => t -> x -> x instance Rotate Transform4 AxisZ AxisW instance Rotate Transform4 AxisY AxisW instance Rotate Transform4 AxisY AxisZ instance Rotate Transform4 AxisX AxisW instance Rotate Transform4 AxisX AxisZ instance Rotate Transform4 AxisX AxisY instance Rotate Transform3 AxisY AxisZ instance Rotate Transform3 AxisX AxisZ instance Rotate Transform3 AxisX AxisY instance Rotate Transform2 AxisX AxisY instance Transformable Vector4 instance Transformable Vector3 instance Transformable Vector2 instance Transformable Vector1 instance Transform Transform4 instance HasSpace Transform4 instance Transform Transform3 instance HasSpace Transform3 instance Transform Transform2 instance HasSpace Transform2 instance Transform Transform1 instance HasSpace Transform1 -- | Convinience module providing all transform functionallity in one -- place. -- -- Note that the transform constructors and fields are not exported from -- here, since the names clash. However, -- Data.Vector.Transform.Fancy provides methods for constructing -- transforms generically, so that shouldn't be an issue. module Data.Vector.Transform -- | 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 :: * -- | 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 :: * -- | 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 :: * -- | 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 :: * -- | Convinience module providing all directly vector-related -- functionallity in one place. module Data.Vector -- | Classes for generically handling bounding boxes, and things that -- possess bounding boxes. module Data.BoundingBox.Fancy -- | Class for dealing with bounding boxes. class (HasSpace b) => BoundingBox b bound_corners :: (BoundingBox b) => Point b -> Point b -> b bound_points :: (BoundingBox b) => [Point b] -> b min_point :: (BoundingBox b) => b -> Point b max_point :: (BoundingBox b) => b -> Point b within_bounds :: (BoundingBox b) => Point b -> b -> Bool union :: (BoundingBox b) => b -> b -> b isect :: (BoundingBox b) => b -> b -> Maybe b -- | Class representing things that possess a bounding box. class (HasSpace x) => HasBBox x get_bbox :: (HasBBox x, BoundingBox b, (Point b) ~ (Point x)) => x -> b instance BoundingBox BBox4 instance HasSpace BBox4 instance BoundingBox BBox3 instance HasSpace BBox3 instance BoundingBox BBox2 instance HasSpace BBox2 instance BoundingBox BBox1 instance HasSpace BBox1 instance BoundingBox Range instance HasSpace Range -- | Convinience module providing all bounding box functionallity in one -- place. module Data.BoundingBox -- | 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. data BBox1 :: * -- | A BBox2 is a 2D bounding box (aligned to the coordinate axies). data BBox2 :: * -- | A BBox3 is a 3D bounding box (aligned to the coordinate axies). data BBox3 :: * -- | A BBox4 is a 4D bounding box (aligned to the coordinate axies). data BBox4 :: *