Use exact barycentric weights to decide whether a point is inside a
triangle.
Example
Use barycentric weights to decide whether a point is inside a triangle.
highlighted = computed this step
Step 1 — Set up
Set up the triangle and test point.
A=(1,1),B=(6,1),C=(2,5),P=(3,2)
Step 2 — Compute alpha
Compute alpha from the area ratios.
α=52
Step 3 — Compute beta
Compute beta from the area ratios.
β=207
Step 4 — Compute gamma
Compute gamma from the area ratios.
γ=41
Step 5 — Check the sum
Check that the three weights sum to one.
α+β+γ=52+207+41=1
Step 6 — Result
State the inside or outside verdict.
inside
barycentric-on-triangleBarycentric weights describe a point as a weighted mix of the triangle vertices. If the weights sum to one and stay nonnegative, the point is inside or on the triangle.