Displace $3$D vertices along a $2$ dimension plane using normals

42 Views Asked by At

I have this one triangle with arbitrary vertices positioned in a 3D space.

It's also easy to find the normal for it with the plane equation.

There is a very simple method for moving the vertices away from the centroid, but that is too linear. I can only move the vertices back and forth.

What is the formula that I need to be able to freely move the existing vertices (independently) or even new ones in a pseudo X/Y axis that is formed from the projection of the triangle normal?

I'm not a math guy so I ask you kindly to be detailed (specially when it comes to matrices).

2

There are 2 best solutions below

0
On BEST ANSWER

Label the three vertices $A$, $B$ and $C$. Assuming that they’re not colinear, every point on their common plane can be expressed in the form $A+\lambda(B-A)+\mu(C-A)$ for $\lambda, \mu \in \mathbb R$. Essentially, the vertex $A$ and the direction vectors $B-A$ and $C-A$ define a coordinate system $(\lambda,\mu)$ for the plane. The three points have coordinates $(0,0)$, $(1,0)$ and $(0,1)$, respectively. If you want to move a point parallel to $B-A$, adjust its $\lambda$-coordinate; to move it parallel to $C-A$, adjust its $\mu$-coordinate.

Depending on what you want to do, you might find an orthonormal coordinate system more convenient. A simple choice is to set $\mathbf u$ to $B-A$, normalized, and $\mathbf v$ to $((B-A)\times(C-A))\times(B-A)$, also normalized. Just as above, every point on the plane can then be expressed in the form $A+s\mathbf u+t\mathbf v$, but now the coordinates $s$ and $t$ are equal to the actual distances from $A$ in the $\mathbf u$ and $\mathbf v$ directions.

You can, of course, choose any of the three points to be the origin of these coordinate systems, and use the two resulting direction vectors in either order.

6
On

If you mean to move it as a rigid body in the plane where it initially lays, having a unit normal vector $\bf n$, then

  • add to all vertices a same displacement vector $\bf d$, which is normal to $\bf n$;

  • take a rotation center point $\bf c$ on the plane (could be the centroid or one of the vertices, or ..), and take a rotation angle $\alpha$, multiply $\bf n$ by that, and add the cross product $ \alpha \bf n \times (\bf v_k- \bf c)$ to each vertex $\bf v_k$.

If, instead, as you commented, you want to move the vertices freely in the plane, then just add different displacement vectors $\bf d_k$ to each vertex. The vectors $\bf d_k$ shall be parallel to the plane, i.e. normal to $\bf n$.
To do that you will need to construct a new (orthogonal) basis having $n$ as one of the axis (as the new z, for example).
But, since you already have the triangle, you can go with a basis that is constituted, e.g. by $\bf a= (\bf v_2-\bf v_1)$, $\bf b =(\bf v_3-\bf v_1 )$, and $\bf n$.
Then $\bf v_k=\mu_k \bf a + \lambda_k \bf b$.