Looking at things from a fresh Angle.
- Radians vs Degrees
- We are all comfortable that a circle can be divided into $360^\circ$
- But we also know that the c++ trig functions want radians.
- What is a radian?
- wikipedia reference
- This is the SI unit for measuring an angle.
- It is a dimensionless unit,
- An angle is measured between 0 and $2\pi$ radians.
- Converting:
- $2\pi $ radians = $360^\circ$
- or $\frac{2\pi}{360}$
- which simplifies to $\frac{\pi}{180}$
- We need this because all trig functions take radians.
- But I don't know trig functions.
- Ok, but well....
- The functions cos and sin are used to compute the relationship between various angels of a right triangle.
- Given a right triangle (or a triangle with a $90^\circ$ angle.
- (Wikipedia)
- (Wikipedia)
- $\cos(\theta) = \frac{adjacent}{hypotenuse}$
- $\sin(\theta) = \frac{opposite}{hypotenuse}$
- $\tan(\theta) = \frac{adjacent}{opposite}$
- sin and cos are great functions
- (Wikipedia again)
- These are the basis for Polar Coordinates
- The is an alternative way to describe a plane.
- Alternative to Cartesian.
- r is a distance from the origin
- $\Theta$ is an angle from the "x" axis.
- $x = r\cos(\Theta))$
- $y = r\sin(\Theta))$
- But first ctx.arc
- reference
- arguments
- center x
- center y
- radius
- Start angle
- end angle
- counterclockwise
- optional bool direction to draw,
- default is false
- Use ctx.beginPath and ctx.stroke or ctx.fill
- A demo
- But I don't want to use those...
- Ok, derive everything from $r^2 = (x - x_c)^2 + (y - y_c)^2$
- where $(x_c, y_c)$ is the center of the circle.
- and $r$ is the radius of the circle