How to parametrize a triangle?

The triangle (i.e. the edges and the interior) is a convex subset in the plane. Thus, any point in it is a convex combination of the 3 vertices $A$, $B$ and $C$. Such a convex combination can be written as $uA+vB+wC$, where $u$, $v$ and $w$ are positive numbers, $uA$ is the multiplication of the vector $A$ by the scalar $u$ and $u+v+w=1$. This last relationship means that the triangle can be parametrised as $\{ (u,v) \in [0,1] \times [0,1] \mid v \le 1-u \} \ni (u,v) \mapsto uA+vB+(1-u-v)C \in \mathbb{R}^2$.

Later edit: I apologise, by "triangle" I had understood the contour and its interior. Apparently, the OP meant just the contour. In this case, the following continuous parametrization defined piecewisely will do: $[0,3] \ni t \mapsto \gamma (t) \in \mathbb{R}^2$, $\gamma(t)=tB+(1-t)A, t\in [0,1]$, followed by $\gamma(t)=tC+(1-t)B, t\in [1,2]$, and then by $\gamma(t)=tA+(1-t)C, t\in [2,3]$. Summed up in a single formula, $\gamma(t)=(tB+(1-t)A) *\chi_{[0,1)}(t)+((t-1)C+(2-t)B) *\chi_{[1,2)}(t)+((t-2)A+(3-t)C) *\chi_{[2,3)}(t).$

(Here $\chi_I$ is the characteristic function of the set $I$. Notice that the intervals are open to the left, since you do not want to count the same point more than once.)


Let $x_{A,B,C}$ be the position vectors respect to the origin $x_0 = (0,0)$. Then, isn't the piecewise (and counterclockwise) parameterization:

$$ \begin{align}x(t) = & (x_A+ t \, (x_B - x_A) ) \, (H(t) - H(t-1)) + \\ & (x_B+ (t-1)\, (x_C - x_B) ) \, (H(t-1) - H(t-2)) + \\ & (x_C+ (t-2) \, (x_A - x_C) ) \,(H(t-2) - H(t-3)) , \quad t \in [0,3), \end{align}$$ useful? Where $H(t)$ is the Heaviside function.

At least in Matlab it does the trick!

Cheers.