1
$\begingroup$

In this question I asked how to deform an object with an spline using animation nodes. The technique explained there the deformation considers all 3 dimensions tilting the output object, but what if I want to deform this object locking the tilt as if it was done with a 2D spline but still deform in a 3d space?, exactly as it is done here.

EDIT

Using @Omar Ahmad answer I managed to get the results I needed. but I'm still a little bit confused. The following image shows the resulting graph:

enter image description here

I'm not quite sure if the new computed normal is correctly linked as in order to get the desired results I was forced to increment its Z value up to 1000.

$\endgroup$
  • 1
    $\begingroup$ You have two normalize nodes, the first one should be connected to the newly computed normals and the second one should be connected to the constant vector (0, 0, 1). Moreover, make sure the spline is indeed 2D by making its points have a z location of 0. $\endgroup$ – Omar Emara Jun 6 at 9:02
3
$\begingroup$

The normal to a point on a spline is equal to the tangent at this point rotated by 90 degrees around the z axis. Let the tangent be $\vec{t} = (x, y)$, then the normal is equal to $R\vec{t}$, where $R$ is a 2D rotation matrix with an angle of $\frac{\pi}{2}$. So the normal is equal to:

$$ \begin{bmatrix} \cos \frac{\pi}{2} & -\sin \frac{\pi}{2} \\ \sin \frac{\pi}{2} & \cos \frac{\pi}{2} \end{bmatrix} \begin{bmatrix} x \\ y \end{bmatrix} = \begin{bmatrix} 0 & -1 \\ 1 & 0 \end{bmatrix} \begin{bmatrix} x \\ y \end{bmatrix} = \begin{bmatrix} -y \\ x \end{bmatrix} $$

So, given the evaluated tangents, you can compute the normals as follows:

Node Tree

To deform an object as described in the answer you linked, you will need a third vector, the one we computed using the cross product. In this case, it will always be the vector $(0, 0, 1)$.

$\endgroup$
  • $\begingroup$ Out of curiosity, when did you start using Animation Nodes? $\endgroup$ – Rita Geraghty stands by Monica Jun 12 at 18:28
  • 1
    $\begingroup$ @RitaGeraghty Don't really remember, maybe early 2017. $\endgroup$ – Omar Emara Jun 12 at 20:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.