Name | Description |
---|---|
Point | A point in the plane |
Line segment | A line segment is a finite line with two endpoints |
Ray | A ray is a line with one endpoint and extends infinitely in one direction |
Line | A line is a set of points that are equidistant from a fixed point |
Plane | A plane is a flat surface that extends infinitely far |
Vector | A vector is a quantity that has magnitude and direction |
Name | Description |
---|---|
Radians | Radians are a unit of angular measure, used in many areas of mathematics. One radian is the angle at the center of a circle subtended by an arc equal in length to the radius of the circle. |
Degrees | Degrees are a unit of angular measure, representing |
atan(y/x) |
atan2(y, x) |
---|---|
from |
from |
Name | Description |
---|---|
PI |
The value of |
EPS |
The value of |
Laws | Description |
---|---|
Law of cosines | |
Law of sines | |
Pythagorean theorem | |
sine | |
cosine | |
tangent |
- The dot product of two vectors is simply the sum of the products of the corresponding elements. For example, the dot product of
$(x_1, y_1)$ and$(x_2, y_2)$ is$x_1 \times x_2 + y_1 \times y_2$ . - Note that this is not a vector, but is simply a single number (called a scalar).
- The reason this is useful is that the dot product,
$A \cdot B = |A||B|Cos(θ)$ , where$θ$ is the angle between the$A$ and$B$ .
Property | Description |
---|---|
Commutative | |
Distributive |
These cases depending on cos() domain:
cases | description |
---|---|
- The cross product of two 2-D vectors is
$x_1 \times y_2 - y_1 \times x_2$ =$A \times B$ =$|A||B|Sin(θ)$ - Technically, the cross product is actually a vector
- Since we’re only working with 2-D geometry for now, we’ll ignore this fact, and use it like a scalar.
- the absolute value of the cross product is the area of the parallelogram formed by the two vectors.
- The direction of the cross product is perpendicular to the plane formed by the two vectors.
- The direction of the cross product is determined by the right-hand rule.
- The magnitude of the cross product is the area of the parallelogram formed by the two vectors.
- The magnitude of the cross product is also equal to the determinant of the matrix formed by the two vectors.
Property | Description |
---|---|
Anti-commutative | |
Distributive |
These cases depending on sin() domain:
cases | description |
---|---|
|
|
|
|
|
complex numbers are a data type that is used to represent a number that can be expressed in the form
Function | Return |
---|---|
real() |
Returns the real part of the complex number (X) |
imag() |
Returns the imaginary part of the complex number (Y) |
abs() |
Returns the absolute value of the complex number (length) |
arg() |
Returns the argument of the complex number (angle) |
conj() |
Returns the conjugate of the complex number (fliping the sign of imaginary part) |
norm() |
Returns the norm of the complex number (squared length) |
polar() |
Returns the polar coordinates of the complex number (length and angle) |
Note:
$*$ The real and imaginary parts of a complex number can be accessed using thereal()
andimag()
methods respectively.
Example: complex.cpp
- Rotation
- Reflection
- distance between two points
- Euclidean distance
- distance point c to line segment ab
- distance point c to line ab
- distance point c to segment ab
- functions
- counter-clockwise test
- A. Where do I Turn? (cross product)
- B. Arpa and an exam about geometry (cross product)
- Closest Distance
- problem
- problem