Mathematics
Vectors
A vector is an object that has a magnitude and a direction. It has two or more elements. For three dimensional geometry we will use three vectors of the form \(\vec{P} = (p_1, p_2 ,p_3)\).
The magnitude of a vector is also known as its modulus.
When used in geometry a vector is a position relative to an origin vector \(\vec{O} = (0, 0, 0)\).
A unit vector has a magnitude of unity and is purely used for defining a direction. A unit vector can be created from any vector by dividing it by its modulus.
Dot Product
The dot product of two vectors is a scalar value.
The dot product of a vector and itself is the square of its modulus \(\vec{a}\cdot\vec{a} = |\vec{a}|^2\).
Cross Product
The cross product of two vectors is a vector which is perpendicular to both vectors.
Line Vectors
A line vector is defined by a position \(\vec{P} = (x_0, y_0, z_0)\) on the line, the direction of the line \(\hat{n}\) and a scalar variable \(\lambda\).
This can be written in terms of coordinates.
To calculate the intersection with another object, the coordinates can be replaced with the scalar parameter. The intersection can be solved for the parameter and then the coordinates recovered.
Vector Plane
A plane can be defined by a position \(\vec{p_0}\) on the plane and a normal vector \(\hat{n}\).
A plane can also be defined from three positions.
Intersection of Two Planes
The intersection of two planes doesn’t exist if the planes are parallel. If it does exist it is a line which is normal to both planes.
The two planes are \(\vec{r}\cdot\hat{n_1} = h_1\) and \(\vec{r}\cdot\hat{n_2} = h_2\). The direction of the line of intersection is normal to both planes \(\hat{n_1}\times\hat{n_2}\). The equation of the line is:
Take the dot product with each normal.
Multiply Equation (13) by \((\hat{n_1}\cdot\hat{n_2})\).
Subtract Equation (12) from Equation (14).
Reorganise Equation (15).
Eliminate \(c_1\) is a similar way.
Intersection of Line and Ellipsoid
The equation of an ellipsoid.
Where \(a\), \(b\) and \(c\) are the semi-axis lengths.
Substitute Equation (7) into Equation (18) and multiply by the semi-axis squares.
Collect the terms in Equation (19).
This is a quadratic equation that can be solved for \(\lambda\). Take the positive square root of the discriminant. The coordinates of the intersection can be calculated from Equation (7).