vect-floating-0.1.0.4: A low-dimensional linear algebra library, operating on the Floating typeclass

Safe HaskellNone
LanguageHaskell98

Data.Vect.Floating.Util.Dim3

Synopsis

Documentation

structVec3 :: [a] -> [Vec3 a] Source

Example: structVec3 [1,2,3,4,5,6] = [ Vec3 1 2 3 , Vec3 4 5 6].

destructVec3 :: [Vec3 a] -> [a] Source

The opposite of "structVec3".

det3 :: Floating a => Vec3 a -> Vec3 a -> Vec3 a -> a Source

translate3X :: Num a => a -> Vec3 a -> Vec3 a Source

translate3Y :: Num a => a -> Vec3 a -> Vec3 a Source

translate3Z :: Num a => a -> Vec3 a -> Vec3 a Source

vec3X :: Num a => Vec3 a Source

vec3Y :: Num a => Vec3 a Source

vec3Z :: Num a => Vec3 a Source

rotate3' Source

Arguments

:: Floating a 
=> a

angle (in radians)

-> Normal3 a

axis (should be a unit vector!)

-> Vec3 a

vector

-> Vec3 a

result

rotate3 Source

Arguments

:: Floating a 
=> a

angle (in radians)

-> Vec3 a

axis (arbitrary nonzero vector)

-> Vec3 a

vector

-> Vec3 a

result

rotMatrix3 :: Floating a => Vec3 a -> a -> Mat3 a Source

Rotation around an arbitrary 3D vector. The resulting 3x3 matrix is intended for multiplication on the right.

rotMatrix3' :: Floating a => Normal3 a -> a -> Mat3 a Source

Rotation around an arbitrary 3D unit vector. The resulting 3x3 matrix is intended for multiplication on the right.

reflect :: Floating a => Normal3 a -> Vec3 a -> Vec3 a Source

Reflects a vector to an axis: that is, the result of reflect n v is 2<n,v>n - v

refract :: (Floating a, Ord a) => a -> Normal3 a -> Vec3 a -> Vec3 a Source

refract' :: (Floating a, Ord a) => a -> Normal3 a -> Normal3 a -> Normal3 a Source

Refraction. First parameter (eta) is the relative refraction index

       refl_inside
eta = --------------
       refl_outside

where "inside" is the direction of the second argument (to vector normal to plane which models the boundary between the two materials). That is, total internal reflection can occur when eta>1.

The convention is that the origin is the point of intersection of the ray and the surface, and all the vectors "point away" from here (unlike, say, GLSL's refract, where the incident vector "points towards" the material)

refractOnly' :: (Floating a, Ord a) => a -> Normal3 a -> Normal3 a -> Maybe (Normal3 a) Source

When total internal reflection would occur, we return Nothing.