BARYCENTRIC a point as weights on a triangle’s corners — three signs say inside
Barycentric coordinates express any point as a weighted blend of a triangle’s three vertices — the weights are the areas of the three sub-triangles, and they sum to one. Their signs settle point-in-triangle at once: if the point is inside, all three cross products (sub-triangle orientations) share a sign; if any sign flips, the point is outside that edge. It is the cross product read three times, and it is how graphics interpolates color, depth, and texture across a triangle — the whole of rasterized 3D leans on these three weights. (2,2) is inside (0,0),(6,0),(0,6); (5,5) is past the hypotenuse.
THE TECHNIQUE three sub-triangle orientations; same sign ⇒ inside
The demo tests two points against a triangle by the sign of three cross products — (2,2) inside, (5,5) outside: live demo
HISTORY & CREDIT Möbius 1827 · barycentric coordinates
“Point-in-triangle needs the triangle’s angles.” — three cross-product signs decide it, and give interpolation weights for free. cited
the weights · the three sub-triangle areas, summing to one — a point as a blend of corners. the test · all three orientations share a sign ⇒ inside; a flip ⇒ outside that edge. 1827 · Möbius — barycentric coordinates; the basis of triangle interpolation in graphics.
A point written as weights on three corners — their signs decide inside, their values interpolate everything. recognizer
RECOMMEND FOR I-13 the three signs, on the compiler
On the canonical compiler, (2,2) is inside triangle (0,0),(6,0),(0,6) (all signs agree); (5,5) is outside:
$ i13 run cg_barycentric.i13 # three orientation signs
RUN OK · 287 step(s) · peak stack 9 · call depth 2
inside = 1 -- (2,2): all three signs agree
outside = 0 -- (5,5): past the hypotenuse x+y=6
test = 1
Recommend as a NULL — a recognizer + interpolation basis. Barycentric containment tests whether a point is inside (B41) via three cross-product signs (B39); the weights it computes are a coordinate representation (B44). Rich — it drives all triangle interpolation — but no enacted invariant. NULL — three reads of the cross product, and the engine of rasterized 3D.