If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

### Course: Pixar in a Box>Unit 15

Lesson 2: Mathematics of rendering

# 6. 3D ray tracing part 2

Now we just need to determine whether our intersection point is inside or outside the triangle. Weighted averages can be used to calculate the intersection point, and we can use vector algebra to solve for the weights. Points with negative weights are outside the triangle, and points with positive weights are inside the triangle. Click here to review weighted averages of three points.

## Want to join the conversation?

• How am I supposed to solve those simultaneous three equations?
• You could put them in a matrix and then put them in reduced echelon form, or just do it directly without using matrices - using simultaneous equations. Keep in mind that they're both the same thing.
• When I'm old enough I definitely want to become an animator! Does anyone else want to?
• Why a+b+c=1 in here?
• They are specified to add up to one to make the equation easier. a, b and c are the weights of a weighted average. You would normally compute a weighted average by computing a * A + b * B + c * C / (a + b + c). However, the result of choosing for instance a=4, b=3, c=1 are always the same as the result of choosing a=8, b=6, c=2. That is to say, you can scale the weights arbitrarily as long as they stay in the same proportion. To make the equation easier, you can define that a, b and c are always scaled in such a way that they add up to 1. You don't need to, but it just makes the equation a bit easier to grasp.
• I already learned linear algebra a while back, so I would like to see an example of using vector algebra - if you could give me an example OR give me a name to a resourceful video topic, that would be very useful!

• I found an article/tutorial by scratchpixel to be very helpful. Just search "calculating barycentric coordinates" on google and it should be the top result.
(1 vote)
• How do you solve for the weights a, b, c
• I have learnt everything here in pixar thanks for it khan academy.
But is there any program or anything where i can try to produce my short story