A demo that I made to increase my understanding of barycentric coordinates. Hopefully this can help at least one other person out there.

Barycentric coordinates, in the context of a triangle, are vertex weights that you use to balance an arbitrary point relative to the triangle. In the manner shown here, the coordinates add up to 1.

Barycentric coordinates provide an easy way to check if a point lies inside/on a triangle, in both 2D and 3D. If any of the values are either less than 0 or greater than 1, the point is guaranteed to be outside of the triangle.

Made in Godot. Code adapted from Christer Ericson's Real-Time Collision Detection book. Read the book for more info on barycentric coordinates.

Leave a comment

Log in with itch.io to leave a comment.