I have been watching this series on khancademy and in it they try to explain how to find out if a ray intersects a triangle. They do a good job explaining how to find the point of intersection of the plane of the triangle but they do an incomplete job of explaining how after that checking if the point is in the triangle is done.
They explain that you can use weighted averages to calculate this by first calculating them and then checking if it's negative or not but in the explanation in the exercises they only pick points of triangles that can exactly be added or subtracted from each other to cancel out. thus being useless for any other situation (which i need because i'm trying to make a ray tracer).
So i want to know how can you calculate the weights of the points that together make up the weighted average
For instance you have 3 points A, B and C each with their xyz value and you have an intersection point I. What do the weights of A,B and C have to be to get point I.
video https://www.khanacademy.org/partner-content/pixar/rendering/rendering-2/v/rendering-10
exercises https://www.khanacademy.org/partner-content/pixar/rendering/rendering-2/e/triangle-intersection-3d (notice how in these exercises they pick points that are always able to cancel each other out which makes their method in the exercises useless when trying to make a ray tracer)