I have some shape (e.g. an ellipse) with some points on it (e.g. $8$). I have plotted below these $8$ points together with $2$ vectors at each point:
- A gradient vector
- The tangent vector (or a basis spanning the tangent line)
As you can see, the tangents don't follow the same "direction", i.e. clockwise or counterclockwise. I am not sure why that's the case but that's fine. Is there a way to take a set of tangent vectors like this and transform them so that they all point "in the same direction" i.e. either all clockwise or counterclockwise?

Consider the case of the ellipse, but the principle is valid in fact for any curve (as one can see on the second figure $(x(t)=k \cos(3t),y(t)=k \sin(t))$).
Let us start from the parametrized representation:
$$\begin{cases}x(t)&=&a \cos(t)\\y(t)&=&b \sin(t)\end{cases}$$
Take the unit tangent vector:
$$T=\begin{cases}x'(t)/n(t)&=&-a \sin(t)/n(t)\\y'(t)/n(t)&=& \ \ \ b \cos(t)/n(t)\end{cases} \ \ \text{where} \ \ \ n(t)=\sqrt{x'(t)^2+y'(t)^2}$$
and take this unit normal vector to T (we have the choice between this one and its opposite):
$$N=\begin{cases} \ \ y'(t)/n(t)&=&b \cos(t)/n(t)\\-x'(t)/n(t)&=&a \sin(t)/n(t)\end{cases}$$
In this way, basis $(N,T)$ is direct. Indeed:
$$\det(N,T)=\begin{vmatrix}\ \ \ y'(t)/n(t)&x'(t)/n(t)\\-x'(t)/n(t)&y'(t)/n(t) \end{vmatrix}=(y'(t)^2+x'(t)^2)/n(t)^2=1$$