2
$\begingroup$

Is it possible to deform an object along a spline in AN just as it can be done with the curve modifier?

I'm trying to do so with the spline falloff node affecting the vertices of my mesh but I'm getting results I can not understand.

So an example would be, given a cylinder transform its vertices in a way which follows an spline object.

EDIT

@Omar Ahmad solution works perfect if our starting point is a clean object. After solving the original question I'm editing my original question for further knowledge.

If we want to combine a series of deformations and add it to our already answered curve deformation, how would it be done? In the following graph you can see my original state: enter image description here

This part of the graph deforms in X each element till it reaches a post, is important to state that those elements have already been deformed in Y before reaching this part of the graph.

enter image description here

So given all this deformations how can I add the deformation of the spline to get my elements to deform like this? (note we have access to yellow spline)

enter image description here

$\endgroup$
3
  • $\begingroup$ Not really sure what you mean by your edit. Can't you just use the output vectors from your initial deformations and use them as the input of the spline deformation? The bounding box can then be computed manually since you are the one who generated the points or by using a max/min operation on the components of the vectors. $\endgroup$
    – Omar Emara
    Commented May 1, 2019 at 17:03
  • $\begingroup$ Yeah, I supposed it would not be clear enough. I was trying to do so (finding a new bounding box for my vectors), can you explain how this would be done? $\endgroup$ Commented May 1, 2019 at 21:15
  • $\begingroup$ Edited the answer, let me know if you need anything else. $\endgroup$
    – Omar Emara
    Commented May 2, 2019 at 9:24

1 Answer 1

6
$\begingroup$

First, you normalize the vertices positions into a unity setting. This is easily done by subtracting the lower-left-forward corner position of the bounding box and dividing by the difference between the upper-right-backward corner position and the lower-left-forward corner position of the bounding box as follows:

Node Tree

You will notice that the vertices are now in a cube located at the origin with length, width, and height of unity. Next, we choose an axis to evaluate the spline at, I will choose the x axis, because I want the cylinder to be deformed along that axis. I will then use the values of that chosen axis to evaluate the spline. We scale the tangent and cotangent based on the values of the other two axis (y and z because we chose x), add the result, and add the evaluated location on top of that as follows:

Node Tree

Want to center it? Just subtract 0.5 from the normalize locations:

Node Tree

You can compute the lower-left-forward and upper-right-backward bounding box points manually from a list of points using the following node tree:

Node Tree

$\endgroup$
6
  • $\begingroup$ is the resulting cylinder thinner than the original? $\endgroup$ Commented May 1, 2019 at 11:52
  • $\begingroup$ @JuanManuelLynch Yes, because we normalize it. You can resize it by using a multiply vector node after the subtract vector node in the last gif. $\endgroup$
    – Omar Emara
    Commented May 1, 2019 at 11:58
  • $\begingroup$ The solution works as expected, I am only having one problem which wasn't explained in the original question as I wanted to keep it simple. My original state is not an object, I'm trying to deform a bunch of vector already deformed by a list of matrices combined together, how can I add the deformation from the spline to the other ones? $\endgroup$ Commented May 1, 2019 at 14:56
  • $\begingroup$ @JuanManuelLynch Please edit the question or ask another question with a more detailed explanation. $\endgroup$
    – Omar Emara
    Commented May 1, 2019 at 15:22
  • $\begingroup$ Adding the multiply vector node gives back control of the size, but is there anyway to keep original dimensions in Y and Z axis? $\endgroup$ Commented May 5, 2019 at 22:28

You must log in to answer this question.

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