# Sun attractor point keep minimum distance

Hi,

I am trying to make a script that simulates plant growth that reacts to the sun’s position.

I made the script (attached) that has three sets of points turned into circles (bottom, middle, top) with varying heights and radii in each set by using MD Slider, graph mapper. and a sun attractor.

The sun attractor is based on the distance so when the sun point moves, the curve gets shorter again, but I want to keep the curve the same length since plants don’t grow shorter.
How can I achieve this?

I also want the curve to be slightly bent towards the sun, right now it just goes straight up but I’m not sure how I can also achieve this. I want the points to move towards the sun within these boundaries.

Thank you!
GENERATIVE PLANTING 2.gh (105.3 KB)

could you please elaborate a bit more in depth the way you want growth to be evaluated?

for instance, it is unclear to me if you want to stack-up the contribution of each position of the sun together into a final unique growth (through Looping or somehow calculating it “a la Delrieu” like in the linked post, or if you want to evaluate the sun-attractor for a given particular position but don’t want farthest plants to shorten because of that (which means somehow just intervening on the domain bounds)

Hi!
I want it to be the second one, so essentially there is a domain for it and maximum height. Once it sun point gets closer and the curve gets longer, the curve should not decrease in length. How would you do this by adjusting the domain? Wouldn’t the curves all stop growing at a certain height rather be more randomized?

ok, so it’s the first one then ?

is this sentence correct?
“I move the slider that controls the position of the sun left to right, and plants are only becoming increasingly longer, never shorter, because growth just accumulates” ?

or is this correct?
“I move the slider that controls the position of the sun, and wherever I move I only see the amount of growth generated by the sun in that particular position”

I initially wanted both to be possible but I’m assuming its not… I want the growth to accumulate but depending on where the sun point is, the growth there occurs first. If not then the first sentence!

I think the easiest way might be to divide the solar path into a finite number of positions, and calculate the “contribution” that each position brings to the growth of each plant, like this:

then you can just filter a range of those values and sum them together to simulate the growth within two particular sun-positions

for instance, I divided into 100 points (100 sun positions), so for each plant-point I get 100 different growth values:

now if I want to understand the total growth for the first 20 sun-positions, I can use something like this:

and somehow simulate what happens in a full sun-arc movement, or just in smaller ranges:

GENERATIVE PLANTING 2_Re.gh (99.0 KB)

is this something closer to what you were thinking?

Hi Jessie

I would use the data recorder in order to store the values you have already grown by so it never goes down in length.

I was gonna have a look at the script but you have some third party component at the beginning of it all so cant get it to work, and don’t like downloading plugins.

You can reparametrize using native surface component