Projection onto affine-hulls Let $S\subseteq \mathbb{R}^n$ be a set of points. 
Let $L(S):=\{\sum_{i=1}^{k} \lambda_i v_i \mid k>0, v_i\in S, \lambda_i\in\mathbb{R}, \sum_{i=1}^n\lambda_i = 1\}$ be the affine-hull of $S$. Let $x\in\mathbb{R}^n$. 
How would you formally define the projection $P(x, S)$ of $x$ onto $L(S)$? 
Since $L(S)$ is a translation of a vector linear space $W$, say $p+W$, then if $P_W$ is the projection matrix onto $W$, I would say that $p+P_W(x-p)$ is the projection onto the affine-hull... but is this correct and the standard way to go?
I'm not really satisfied by this definition because the relation between $L(S)$ and $x$ is shadowed by $p,W \!$...

I would define the projection on a affine subspace of an euclidean space as the map which sends any point to the closest one in the affine subspace.
In your case the subspace is defined as the smallest affine subspace containing a given set of points $v_1,\dots, v_k$. Let $w_j = v_{j}-v_k$ for $j=1,\dots, k-1$. You should apply the orthonormalization process to the vectors $w_j$ to find an orthonormal base $e_1,\dots, e_n$ such that the space generated by $e_1,\dots,e_m$ is equal to the space generated by $w_1,\dots,w_k$ (of course $m\le k$). In such a base the linear part of the projection is represented in coordinates by $P(x_1,\dots,x_n) = (x_1, \dots, x_m, 0, \dots ,0)$.
