- class Vec3 v where
- data Matrix v
- origin :: v
- fromXYZ :: (Double, Double, Double) -> v
- toXYZ :: v -> (Double, Double, Double)
- zipWith :: (Double -> Double -> Double) -> v -> v -> v
- (<+>) :: v -> v -> v
- (<->) :: v -> v -> v
- (><) :: v -> v -> v
- (.^) :: v -> Double -> v
- (.*) :: v -> v -> Double
- norm :: v -> Double
- normalize :: v -> v
- distance :: v -> v -> Double
- invert :: v -> v
- fromRows :: (v, v, v) -> Matrix v
- toRows :: Matrix v -> (v, v, v)
- dotM :: v -> v -> Matrix v -> Double
- mxv :: Matrix v -> v -> v
- diag :: Double -> Matrix v
- vxv :: v -> v -> Matrix v
- addM :: Matrix v -> Matrix v -> Matrix v
Three-dimensional vector, with an associated matrix type.
(0, 0, 0).
Construct a new vector from components.
Deconstruct a vector into components.
Zip two vectors elementwise.
Add two vectors.
Subtract two vectors.
Scale a vector.
Euclidean norm of a vector.
Produce unit vector with the same direction as the original one.
Distance between two points.
Invert the direction of a vector.
Construct a new matrix from rows.
Deconstruct a matrix into rows.
Generic vector dot product.
Multiply the transpose of the first vector by the given matrix, then multiply the result by the second vector.
[ a11 a12 a13 ] [ v2x ] [ ] [ ] [ v1x v1y v1z ] . [ a21 a22 a23 ] . [ v2y ] = s [ ] [ ] [ a31 a32 a33 ] [ v2z ]
Multiply a matrix and a vector.
[ a11 a12 a13 ] [ v2x ] [ rx ] [ ] [ ] [ ] [ a21 a22 a23 ] . [ v2y ] = [ ry ] [ ] [ ] [ ] [ a31 a32 a33 ] [ v2z ] [ rz ]
Build a diagonal matrix from a number
[ d 0 0 ] [ ] [ 0 d 0 ] [ ] [ 0 0 d ]
Transpose a vector and multiply it by another vector, producing a matrix.
[ v1x ] [ r11 r12 r13 ] [ ] [ ] [ v1y ] . [ v2x v2y v2z ] = [ r21 r22 r23 ] [ ] [ ] [ v1z ] [ r31 r32 r33 ]
Add two matrices.