# Deform geometry along spline in Animation Nodes

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: 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. 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) • 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. May 1, 2019 at 17:03
• 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? May 1, 2019 at 21:15
• Edited the answer, let me know if you need anything else. May 2, 2019 at 9:24

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: 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: Want to center it? Just subtract 0.5 from the normalize locations: 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: • is the resulting cylinder thinner than the original? May 1, 2019 at 11:52
• @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. May 1, 2019 at 11:58
• 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? May 1, 2019 at 14:56
• @JuanManuelLynch Please edit the question or ask another question with a more detailed explanation. May 1, 2019 at 15:22
• Adding the multiply vector node gives back control of the size, but is there anyway to keep original dimensions in Y and Z axis? May 5, 2019 at 22:28