# Barycentric Coordinates

Learn how to calculate the barycentric coordinates of a triangle face.

We'll cover the following

## Overview

The concept of barycentric coordinates comes up quite often in computer graphics applications. For example, given a textured 3D model, each face of the model needs some kind of mapping to the texture to know how it should appear. For a 3D model composed of 2D polygon faces, we need a way to describe the location of any 2D point on a face. Barycentric coordinates provide such a method to describe the relative location of a point on a face. Understanding what they are and how they work is integral to shading and rendering in particular.

## Barycentric coordinates

To put it simply, barycentric coordinates are a local coordinate system for a triangle of geometry. They describe a single point on a triangle face as a combination of the three vertices of the triangle. In other words, for a triangle with vertices $A$, $B$, and $C$ (in counterclockwise order), they describe how close a point $P$ is to $A$, $B$, and $C$ within the plane formed by that face.

Imagine three springs and three points $A$, $B$, and $C$. Tie the end of the first spring to the point $A$, the end of the second spring to the point $B$, and the end of the third spring to the point $C$. Next, take the free end of all three springs and tie them to the point $P$. Notice how the springs joined by $P$ divide the triangle into three smaller triangles. As $P$ moves around, the shape of these triangles changes. We’ll denote the three subtriangles formed by $P$ as $u$, $v$, and $w$.