Background: This is for a programming assignment. The actual programming work is no problem, but I'm just having trouble understanding the equations/formulas.
Given Data: I'm only given 3 points for the plane (PA, PB, PC), and 2 for a line (P1 and P2).
Question: Given the data above and the information below.
What is P and what is P0? Where am I getting those two variables?
Why am I solving for α in the last equation if α was supposed to be my scalar?
I'm just confused by the chain-linking of so many formulas honestly. I've simplified these instructions as much as I could. They were even more confusing in their original form.
------
Equation of a Plane
The equation of a plane is: n.(P - P0) = 0
n is the normal to the plane (I've got this calculated) P0 is a point on the plane (Where do I get this using my data?) P-P0 is point-point subtraction (I've got this formula too) n.(P-P0) is the dot product between n and (P-P0) (I have the dot product formula as well)
Parametric Equation of a Line
The parametric equation of a line is: P(α) = (1-α)P1 + α*P2
P1 and P2 are points on the line (got this) α is a scalar (got this)
Note that when α is 0, P(α) = P1, and when α is 1, P(α) is P2. The other points on the line are obtained by letting α take on other values.
The dot product represents the cosine of the angle between the two vectors. If that dot product must be 0, then the angle between the vectors must be 90 degrees. Since n is the direction away from the plane, it already makes an angle of 90 degrees with the plane. This means that the direction (P-P0) must have no component out of the plane. As P0 is known to be a point on the plane, P must also be on the plane for the equation to hold.
To identify a point that is both on the line and on the plane, simply plug in the parametric equation of a line into the equation for the plane and solve for α.
α = n.(P0-P1)/n.(P2-P1)
P0 is the point on the plane P1 and P2 are the points on the line
Finally, plug this α into the parametric equation of the line and you have the point of intersection.
So you want to compute the intersection of a plane (given by 3 points) and a line (given by 2 points)?
The plane equation $$\vec{n}.(P-P_0) = 0$$ says that given a point $P_0$ in the plane and given a normal vector $\vec{n}$ of the plane, all points $P$ in this plane fulfill the above equation. To get the plane equation for three points $PA, PB, PC$ you first must compute the normal vector, e.g. by $$ \vec{n} = (PB-PA) \times (PC-PA)$$ using the so called "cross product" or "vector product". Then you can choose any one of $PA,PB,PC$ as $P_0$.
The function $$P(\alpha) = (1-\alpha)P_1 + \alpha P_2$$ gives all points on the line through $P_1,P_2$ when $\alpha$ runs through all real numbers.
The problem of intersection is now solved by finding a value for $\alpha$ s.t. $P(\alpha)$ lies in the given plane. So all you have to do is: