vect-0.4.7: A low-dimensional linear algebra library, tailored to computer graphics.

Data.Vect.Float.Util.Dim3

Synopsis

Documentation

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

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

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

The opposite of structVec3.

rotate3'Source

Arguments

:: Float

angle (in radians)

-> Normal3

axis (should be a unit vector!)

-> Vec3

vector

-> Vec3

result

rotate3Source

Arguments

:: Float

angle (in radians)

-> Vec3

axis (arbitrary nonzero vector)

-> Vec3

vector

-> Vec3

result

rotMatrix3 :: Vec3 -> Float -> Mat3Source

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

rotMatrix3' :: Normal3 -> Float -> Mat3Source

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

reflect :: Normal3 -> Vec3 -> Vec3Source

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

refract' :: Float -> Normal3 -> Normal3 -> Normal3Source

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' :: Float -> Normal3 -> Normal3 -> Maybe Normal3Source

When total internal reflection would occur, we return Nothing.