Analytic geometry
Analytic geometry is the study of geometry using coordinates. This is very much what you have been doing in the previous block with the vector and matrix algebra. In the case of 2D, that would be an ordered pairs of coordinates.
Equations define subsets of the plane or volume. Let’s assume we are working on a plane. An equation would often define a curve on it. For example, a linear equation would define a line:
This kind of equation is called implicit equation (we'll come back to that later).
A square equation will define conic section, a parabola for example.
More complex equations can result in more complex shapes. The principle exends to 3D.
Line
Let's start by anaizying the equation of a line. The susbset of that satisfies the linear equation
is a line. Let's plot such a line.
Often we use an angle (or inclination) and intercept to describe a line. The angle is measured from the postive x-axis to the line. Inclination is the tan of the angle. The equation in this form is:
Where m is the inclination and b the y intercept.
We can convert from one form of the equation to the other.
Both forms of the line equation that were given are impicit. This means every x and y that satisfy the equation are on the line. The second form lets us calculate the y value for evey x value, but using implicit equation is not the best solution for all problems. Often is easier to work with a set of parametric equtions. One for each dimension and one parameter for each degree of freedom (for ex. 1 for a curve/line, 2 for a surface). The parametric equations for a line look like this.
A parametric equation for a line is basically made out of a point on the line and a direction vector, multiplied by the parameter . In vector form it might be a bit more clear.
If the direction is normalized, the the parameter will give us the signed distance from the intial point.
Any two non-paralel lines will instersect. Two paraler lines wll either overlap or have not intersection. Let us start off with an example.
We have two lines defined with the equations.
To find the intersection we need to find such and the satisfy both equations. We can rewrite the system as:
We can solve the system using Sage and the solve function
The equivalend of a line in 2D is a plane in 3D. A plane can de defined by a point on the plane and normal. The equation could be written to take all the poistions such that the vector drawn from to is perpendicular to .
The general equation of a plane in 3D can be derived from that formula.
Naturally, we can extend the intersection problem to 3D. For example, let's try to find the intersection of three planes, described by the folowing system.
We can also write this in a matrix form
If we multiply the system with we get the solution of the system.
This is why the methods for finding an inverse of a matrix and finding solutions for systems of linear equations are tightly connected. We will use sage here to solve the system in it's matrix form and appying the inverse. And then repeat the same using the Gaussian elliminations method (which probably takes another full workshop to practise, but do check the Wikipedia article in meantime).
Gaussian elliminations starts with creating an augumented matrix, by appending the vector. We apply elementary row operations untill we get a identity matrix on the left side. The alowed ERO are:
Swapping two rows.
Multiplying a row by a non-zero number.
Adding a multiple of one row to another row.
Circle
A circle can be defined by all the points that are at equal distnace from it's center. Let's first assume that the center is at and has a radius . The equation is:
If we assume that center is at , we simply translate the equation:
The general equation of a circle is a square equation with form:
With center at and radius
Lastly a circle can be defined with parameric equations:
Ellipse
Circles, ellipses and parabolas and hyperbolas are called conic sections, as they can be derived by intersecting a cone (the mathematical endless, double sided one) and a plane. Sometimes we use the short name conics. We will only focus on the ellipse in this workshop and it's the most usefull one for graphics and collision detection.
An ellipse can be defined using it's major axis and minor axis . Let's first assume that the center is at . The equation is:
If we assume that center is at , we simply translate the equation:
Lastly a circle can be defined with parameric equations: