Formula Summary
Table of Content
Points
Mid Point
Distance
Vectors in 2D and 3D
Length
Dot product (Info)
| Result (Scalar) | Angle between |
|---|---|
Angle between 2 vectors
Special cases
| Dot product result | Angle |
|---|---|
| -1 | |
| 0 | |
| 1 |
For dot product 1 and -1 NEED to be unit vectors. For dot product 0, it doesn't matter
Checking if vectors are parallel/perpendicular
For parallel
For perpendicular
See Dot product, Special cases
Vector Projection (Info)
Project
General:
If
Checking if moving towards a point
Only 1 point moving
Get vector
Find
At
At
At
2 points moving
Assume P is stationary **relative** to Q, Then same as [[#Only 1 point moving]] except use:Result =
Result < 0, moving towards
Result = 0, Neither moving towards/away
Result > 0, moving away
Imagine P and Q are cars at a intersection. And you are sitting in car P.
From my perspective, Car Q moves towards me relative to my (Car P) current speed.
Vectors in 2D
Making a normal vector
- Swap
and - Negate either the
or - Negate
to rotate anti-clockwise - Negate
to rotate clockwise
- Negate
Linear equation
For reference, this is the normal way to represent an equation
Where
= slope and = y-intercept
Find using and 1 point (Proof)
Expanded out:
Vector equation
Notation
Find vector equation using 2 points
Linear Vector equation
Parametric equation
Finding shortest distance
Point to line
Given
P is a point on the line as the normal starts from the line too
Checking if a moving point will hit line
| Hit | Miss |
|---|---|
| Hit if the signs of these 2 are different |
Or in code:
Vectors in 3D
Line
Linear equation in 3D is a Plane
Quick normal vector in 3D
Steps (Similar to 2D):
- Set one of the coords to 0,
- Swap the other 2 coords
- Negate one of them
Plane
Notation
A plane equation can be represented by
Vector equation
Using 2 direction vectors, $$\vec{x}=P+s\vec{u}+t\vec{v}$$ > [!WARNING] $\vec{u}$ and $\vec{v}$ cannot be parallel ##### 3 Points $\to$ Vector equation Given $P, Q, R$, $$ \vec{x}=P+s\vec{PQ}+t\vec{PR} $$Vector Linear equation
Find
Linear equation
Same as 2D, $$ \vec{x}\cdot \vec{n}=\vec{OP}\cdot \vec{n} $$ ### Cross product Used to find normal of 2 vectorsTo check, make sure
- 4 fingers pointing the direction from
- thumb points to the result of the cross product.
NOTE:
Related: Point to Line dist in 3D
Distances for lines
Point to Line
--- Using cross product (recommended)
$d(P,l)=\frac{\text{Area of parallelogram}}{||\vec{d}||}=\frac{||\vec{QP}\times \vec{d}||}{||\vec{d}||}$
--- Using projection
$
\begin{align}
\vec{QH}&=proj_{\vec{d}}{\vec{QP}} \\
\vec{HP}&=\vec{HQ}+\vec{QP} \\
d(P,l)&=||\vec{HP}||
\end{align}
$
Line to Plane
See Plane to Line below
Line to Line
Given
- If
parallel to - Distance =
- Point to Line
- Distance =
- If
NOT parallel to , - Make a plane containing
that's parallel to - Distance =
- Plane to Point
- Make a plane containing
Distances for planes
Plane to Point
Same as Point to line dist in 2D
Given
P is a point on the plane as the normal starts from the line too
Plane to Line, Plane to Plane
There are 2 cases:
- If plane/line is NOT parallel to the other plane, distance = 0
- If plane/line is parallel to the other plane,
- Treat it as Plane to Point
Distance =
- Treat it as Plane to Point
Examples:
--- Plane to Plane
Given planes
- $\alpha:P,\vec{n}_{\alpha} \implies\vec{x}_{\alpha}\cdot \vec{n}_{\alpha}=\vec{x}_{\alpha}\cdot \vec{OP}$
- $\beta:Q,\vec{n}_{\beta}\implies\vec{x}_{\beta}\cdot \vec{n}_{\beta}=\vec{x}_{\beta}\cdot \vec{OQ}$
There are 2 cases:
- $\alpha$ and $\beta$ intersect $\to$ $\vec{n}_{\alpha}$ NOT parallel to $\vec{n}_{\beta}$
$
\text{So, }d(\alpha,\beta)=0
$
- $\alpha$ and $\beta$ are parallel $\to$ $\vec{n}_{\alpha}$ parallel to $\vec{n}_{\beta}$
$
d(\alpha,\beta)=d(P,\beta)=||proj_{\vec{n}_{\beta}}{\vec{QP}}||
$
This is same as Plane to Point (Treat the other plane as a point as it's parallel).
--- Plane to Line (css-class: pdf-page-break)
Given:
- $\alpha:P,\vec{n}_{\alpha} \implies\vec{x}_{\alpha}\cdot \vec{n}_{\alpha}=\vec{x}_{\alpha}\cdot \vec{OP}$
- $l:Q,\vec{d}\implies \vec{x}=Q+t\vec{d}$
There are 2 cases:
- $\alpha$ and $l$ intersect $\to$ $\vec{d}$ NOT $\perp$ $\vec{n}_{\alpha}$
$
\text{So, }d(l,\alpha)=0
$
- $\alpha$ and $l$ are parallel $\to$ $\vec{d} \perp \vec{n}_{\alpha}$
$
d(l,\alpha)=d(P,\alpha)=||proj_{\vec{n}_{\alpha}}{\vec{QP}}||
$
This is same as Plane to Point (Treat the other line as a point as it's parallel).
Others
Are 2 lines the same
Same if (both true):
is a point on