Silly question but I am not figuring it out on my own.

In 3D you can scale a point / shape / field along a canonical direction quite easily:

$p = (x_0, x_1, x_2)$ becomes $p = (ax_0, x_1, x_2)$ for example if we wanted to scale along the first axis. This map has the property that distances in any plane parallel to the plane $(x_1, x_2)$ remain unaffected.

Now given an arbitrary vector $N$ I want to induce the same transformation along the direction of $N$.

One possible solution, of course, is to find a rotation that transforms $N$ into one of the canonical directions, scale that direction, then invert the transformation. i.e. $RSR^{-1}$.

However this is inelegant, I am trying to do it in a way that involves only $N$ and requires no change of basis. i.e. I want to scale points along $N$ without changing the coordinate space, and perhaps better, in a coordinate free way.

  • $\begingroup$ If you are doing it coordinate free, then “(non-)canonical direction” would have no meaning, because there would be no preferred frame of reference. $\endgroup$
    – rschwieb
    Commented Dec 12, 2020 at 3:40
  • $\begingroup$ The point is with the current $RSR^{-1}$ method you HAVE to have a reference frame in order to compute an arbitrary scaling. I am looking for a way you can achieve the same result but avoid reasoning through a fixed refrence frame. $\endgroup$
    – Makogan
    Commented Dec 12, 2020 at 3:54

2 Answers 2


Given any vector $\vec{v}$, there is a unique way to decompose $\vec{v}$ into a component along $N$ and a component orthogonal to $N$, namely $\vec{v} = \operatorname{proj}_N(\vec{v}) + (\vec{v} - \operatorname{proj}_N(\vec{v}))$. Moreover, there's a nice formula: $\operatorname{proj}_N(\vec{v}) = \left(\frac{N \cdot \vec{v}}{N \cdot N}\right)N$.

If I understand the question correctly, the thing you want to do is send $\vec{v}$ to $a\operatorname{proj}_N(\vec{v}) + (\vec{v} - \operatorname{proj}_N(\vec{v}))$.

In particular, in the case where $N = (1, 0, 0)$, and $\vec{v} = (x_0, x_1, x_2)$, we have $$a\operatorname{proj}_N(\vec{v}) + (\vec{v} - \operatorname{proj}_N(\vec{v})) = a(x_0, 0, 0) + (x_0, x_1, x_2) - (x_0, 0, 0) = (ax_0, x_1, x_2)$$ This shows that the construction I described agrees with what you're saying should happen when you scale along one of the coordinate axes.

  • $\begingroup$ You gave me the hint I needed to complete this so I am marking it as the accepted answer, I will also provide the full answer. $\endgroup$
    – Makogan
    Commented Dec 12, 2020 at 19:03

The way to construct a matrix that does this is as follows:

The component of $P$ parallel to $N$ is $N\cdot P N = (N^TP)N = NN^TP$

Thus $-NN^T P + P = (-NN^T + I)P$ is P minus its component orthogonal to $N$. Thus $(-NN^T + I)P + sNN^TP$ is the scaling of $P$ along the direction $N$ as described in Chris Eagle's answer.

We get:

$$(-NN^T + I)P + sNN^TP = (-NN^T + I + sNN^T)P$$ $$ = (NN^T(-I + sI) + I)P$$ $$ = (NN^T(s - 1) + I)P$$

Thus the matrix $((s - 1)NN^T + I)$ Represents a linear scaling along the direction $N$ for any $P$ in a coordinate free way.

Notice that matrix must be symmetric btw.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .