Knowledge Base¶
Contents:
Geometric Operations¶
Homogeneous Point¶
Homogeneous coordinates are used to support translation.
If the fourth component is not 1, the point can be normalized:
Translation¶
Rotation¶
Scaling¶
Transforming Normals¶
Normals cannot be transformed like normal vectors. Transpose of the inverse of a transformation matrix must be used to transform normals:
Coordinate Systems¶
Vector | Left-handed | Right-handed |
---|---|---|
Right | x | x |
Forward | y | -z |
Up | z | y |
Interpolation¶
General Form¶
- \(\mathrm{F}\)
- Interpolation function.
- \(a, b\)
- Values to interpolate between.
- \(r\)
- Interpolation factor.
To Interpolate in n dimensions, apply 1D interpolation recursively to collapse them one by one. Until there is only a scalar value:
This would mean \(2^n-1\) applications of \(\mathrm{F}\).
Linear Interpolation¶
1D¶
- \(x_a, x_b\)
- Values to interpolate between.
- \(r\)
- Interpolation factor.
2D¶
- \(z_{00}, z_{01}, z_{10}, z_{11}\)
- Values to interpolate between.
- \(x, y\)
- Interpolation factors.
Cosine Interpolation¶
1D¶
- \(x_a, x_b\)
- Values to interpolate between.
- \(r\)
- Interpolation factor.
2D¶
- \(z_{00}, z_{01}, z_{10}, z_{11}\)
- Values to interpolate between.
- \(x, y\)
- Interpolation factors.
Cubic Interpolation¶
- \(x_0, x_1, x_2, x_3\)
- Values to interpolate between.
- \(r\)
- Interpolation factor.
Bezier Curve¶
Optimized:
- \(x_0, x_1, x_2, x_3\)
- Values to interpolate between.
- \(r\)
- Interpolation factor.
Matrices¶
Identity Matrix¶
Matrix Multiplication¶
Also known as matrix product.
To be able to multiply two matrices, column count of the first matrix must be equal to the row count of the first matrix.
Resulting matrix has as many rows as the first operand and as many columns as the second operand:
Matrix multiplication is not a commutative operation.
Transposition¶
Inversion¶
To be invertible a matrix:
- Must be square. (Must have equal number of rows and column.)
- Determinant must not be zero.
Multiplying a matrix with its inverse yields identity matrix:
Gauss-Jordan Method¶
Elementary row operations are:
- Swap rows.
- Multiply (or divide) each element in a row with a constant
- Add a multiple of another row to a row.
Gauss-Jordan method is applying elementary row operations to a matrix \(M\) until it is equal to identity vector and applying the same operations to identity vector which ends up being \(M^{-1}\).
- Ensure, for each column pivot (\(1\)‘s in identity matrix) is non-zero.
- For each row set non-pivot values to zero.
- Scale each pivot to one.
Example:
Swap rows 1 & 2:
All pivots are non-zero now. Add row 2 to row 0:
Add to row 1, row 2 divided by 2:
Add to row 1, row 0 multiplied by -0.2:
Add to row 2, row 0 multiplied by -0.4
Multiply row 0 with 0.2 and row 2 with -0.5
Result:
Relational Algebra¶
Binary Operators¶
- ∪ set union
- ∩ set intersection
- - set difference
- ⨯ carthesian product
Unary Operators¶
- π projection
- σ restriction
- ρ rename
Joins¶
- ⋈ natural join
- θ-join & equijoin
- ⋉ & ⋊ semijoin
- ▷ antijoin
- ÷ division
Resources¶
Vectors¶
Length of a Vector¶
Result is a scalar.
Normalizing¶
Result is a vector with \(length = 1\).
Addition and Subtraction¶
Result is a vector.
Multiplication and Division¶
With a scalar:
With another vector:
Result is a vector.
Dot Product¶
Result is a scalar.
Length can be derived from dot product of vector with itself:
Dot product is a commutative operation:
Dot product of two unit vectors is the cosine of the angle between:
Cross Product¶
Result is a vector.
Cross product is anticommutative:
Spherical Coordinates¶
A left-handed coordinate system (z-up) is used below:
- \(\theta\) (polar)
- Angle perpendicular to xy plane.
- \(\phi\) (azimuth)
- Angle that lies on xy plane.
Given a unit vector:
Spherical coordinates can be converted to a unit vector using: