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

Data.Vect.Double.Util.Dim3

Synopsis

Documentation

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

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

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

The opposite of structVec3.

Arguments

 :: Double angle (in radians) -> Normal3 axis (should be a unit vector!) -> Vec3 vector -> Vec3 result

Arguments

 :: Double angle (in radians) -> Vec3 axis (arbitrary nonzero vector) -> Vec3 vector -> Vec3 result

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

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

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

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)

When total internal reflection would occur, we return Nothing.