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

Safe HaskellNone

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 -> aSource

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

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

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

vec3X :: Num a => Vec3 aSource

vec3Y :: Num a => Vec3 aSource

vec3Z :: Num a => Vec3 aSource

rotate3'Source

Arguments

:: Floating a 
=> a

angle (in radians)

-> Normal3 a

axis (should be a unit vector!)

-> Vec3 a

vector

-> Vec3 a

result

rotate3Source

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 aSource

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

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

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 aSource

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 aSource

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

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.