-----------------------------------------------------------------------------
-- |
-- Module      :  Diagrams.ThreeD.Vector
-- Copyright   :  (c) 2013 diagrams-lib team (see LICENSE)
-- License     :  BSD-style (see LICENSE)
-- Maintainer  :  diagrams-discuss@googlegroups.com
--
-- Three-dimensional vectors.
--
-----------------------------------------------------------------------------
module Diagrams.ThreeD.Vector
       ( -- * Special 3D vectors
         unitX, unitY, unitZ, unit_X, unit_Y, unit_Z
       , xDir, yDir, zDir
       ) where

import           Control.Lens          ((&), (.~))

import           Diagrams.ThreeD.Types
import           Diagrams.TwoD.Vector
import           Diagrams.Direction

import           Linear.Vector

-- | The unit vector in the positive Y direction.
unitZ :: (R3 v, Additive v, Num n) => v n
unitZ :: forall (v :: * -> *) n. (R3 v, Additive v, Num n) => v n
unitZ = forall (f :: * -> *) a. (Additive f, Num a) => f a
zero forall a b. a -> (a -> b) -> b
& forall (t :: * -> *) a. R3 t => Lens' (t a) a
_z forall s t a b. ASetter s t a b -> b -> s -> t
.~ n
1

-- | The unit vector in the negative X direction.
unit_Z :: (R3 v, Additive v, Num n) => v n
unit_Z :: forall (v :: * -> *) n. (R3 v, Additive v, Num n) => v n
unit_Z = forall (f :: * -> *) a. (Additive f, Num a) => f a
zero forall a b. a -> (a -> b) -> b
& forall (t :: * -> *) a. R3 t => Lens' (t a) a
_z forall s t a b. ASetter s t a b -> b -> s -> t
.~ (-n
1)

-- | A 'Direction' pointing in the Z direction.
zDir :: (R3 v, Additive v, Num n) => Direction v n
zDir :: forall (v :: * -> *) n. (R3 v, Additive v, Num n) => Direction v n
zDir = forall (v :: * -> *) n. v n -> Direction v n
dir forall (v :: * -> *) n. (R3 v, Additive v, Num n) => v n
unitZ