Moving to attractor

Hi everyone, happy sunday

I’m trying to move some curves on the z axis based on their distance from one of them. I want to achive a result like the one in the image: i want to keep the first and last crv of the contour in the original position and move only those in between near to the chosen one, like a gradient (in a “attractor logic”).

what i have tried so far is in the attached file. Maybe the solution can involve ScaleNU but i dont know how to set the z parameter and keep the first and last crv in place; maybe i’m missing something in the remap logic or i need to go deeper in the attractor. while i continue my research i want to ask u for a hint or a help if u have time. hope i’ve been clear.

Thanks to anyone who shares an idea on how to do it

AdaptiveLayerHeight_V1.gh (19.2 KB)

This way using ScaleNU , you can Move them to the attractor (also kept the first and last curve as you wished)

Cheers !
AdaptiveLayerHeight_V1.gh (13.9 KB)


(also this file has a graph mapper for more control) :
AdaptiveLayerHeight_V1_GraphMapper.gh (14.9 KB)

1 Like

I did it right at the beginning by mapping Z values either side of the “pinch” to 0to1 , graph mapping to get the curve then remapping back to the original domains. Then pass that list of Z values to the Contour Ex component. Keeps all the maths upstream of the geometry.

AdaptiveLayerHeight_gmapper.gh (14.1 KB)

Output currently has each curve in its own Branch of the tree. Trim Tree will get you a flat list.

Thank you very much for your help

I took a look at your script and I have to say that the logic of keeping math and geometry separate is incredible, I hadn’t thought about it and you opened my eyes to new scenarios.

If you have time to explain it to me, would you let me know the meaning of the expression x+1 in the integer component? i dont think i fully understand that. while everything else seems to add up even if I have to understand this logic better. thanks again

It’s just a typical “off by one” correction for what is known as a “fence post error.” When you’re building a fence, you always need one more post than panels.

In this case, dividing the height by the Division gives us the number of “panels” but we want to generate a series of coordinates for the “posts” so we need to add 1.

1 Like