Maintainer | diagrams-discuss@googlegroups.com |
---|---|
Safe Haskell | None |
Basic types for three-dimensional Euclidean space.
- data R3
- r3 :: (Double, Double, Double) -> R3
- unr3 :: R3 -> (Double, Double, Double)
- mkR3 :: Double -> Double -> Double -> R3
- type P3 = Point R3
- p3 :: (Double, Double, Double) -> P3
- unp3 :: P3 -> (Double, Double, Double)
- mkP3 :: Double -> Double -> Double -> P3
- type T3 = Transformation R3
- r3Iso :: Iso' R3 (Double, Double, Double)
- p3Iso :: Iso' P3 (Double, Double, Double)
- class Num a => Angle a where
- newtype Turn = Turn Double
- asTurn :: Turn -> Turn
- type CircleFrac = Turn
- newtype Rad = Rad Double
- asRad :: Rad -> Rad
- newtype Deg = Deg Double
- asDeg :: Deg -> Deg
- fullTurn :: Angle a => a
- convertAngle :: (Angle a, Angle b) => a -> b
- angleRatio :: Angle a => a -> a -> Double
- class Direction d where
- toSpherical :: Angle a => d -> Spherical a
- fromSpherical :: Angle a => Spherical a -> d
- data Spherical a = Spherical a a
- asSpherical :: Spherical Turn -> Spherical Turn
3D Euclidean space
The three-dimensional Euclidean vector space R^3.
type T3 = Transformation R3Source
Transformations in R^3.
Two-dimensional angles
These are defined in Diagrams.TwoD.Types but reëxported here for convenience.
class Num a => Angle a whereSource
Type class for types that measure angles.
Convert to a turn, i.e. a fraction of a circle.
Convert from a turn, i.e. a fraction of a circle.
Newtype wrapper used to represent angles as fractions of a circle. For example, 1/3 turn = tau/3 radians = 120 degrees.
The identity function with a restricted type, for conveniently
declaring that some value should have type Turn
. For example,
rotation . asTurn . fromRational
constructs a rotation from a
rational value considered as a Turn
. Without asTurn
, the angle
type would be ambiguous.
type CircleFrac = TurnSource
Deprecated synonym for Turn
, retained for backwards compatibility.
Newtype wrapper for representing angles in radians.
The identity function with a restricted type, for conveniently
declaring that some value should have type Rad
. For example,
rotation . asRad . fromRational
constructs a rotation from a
rational value considered as a value in radians. Without asRad
,
the angle type would be ambiguous.
Newtype wrapper for representing angles in degrees.
The identity function with a restricted type, for conveniently
declaring that some value should have type Deg
. For example,
rotation . asDeg . fromIntegral
constructs a rotation from an
integral value considered as a value in degrees. Without asDeg
,
the angle type would be ambiguous.
convertAngle :: (Angle a, Angle b) => a -> bSource
Convert between two angle representations.
angleRatio :: Angle a => a -> a -> DoubleSource
Calculate ratio between two angles
Directions in 3D
Direction is a type class representing directions in R3. The interface is based on that of the Angle class in 2D.
toSpherical :: Angle a => d -> Spherical aSource
Convert to polar angles
fromSpherical :: Angle a => Spherical a -> dSource
Convert from polar angles
A direction expressed as a pair of spherical coordinates.
`Spherical 0 0` is the direction of unitX
. The first coordinate
represents rotation about the Z axis, the second rotation towards the Z axis.
Spherical a a |
asSpherical :: Spherical Turn -> Spherical TurnSource
The identity function with a restricted type, for conveniently
restricting unwanted polymorphism. For example, fromDirection
. asSpherical . camForward
gives a unit vector pointing in the
direction of the camera view. Without asSpherical
, the
intermediate type would be ambiguous.