12
$\begingroup$

The long story short is that geometry A has a "accumulated area" attribute describing cumulative area covered by each consecutive point on a curve. Geometry B needs to copy the position of a point on Geometry A when "cumulative area" on Geometry A has just exceeded the index of Geometry B. I cannot simply filter geometry A because sometimes two points on Geometry B will map to the same position on geometry A.

enter image description here

I've hit a brick wall so I'll also describe what I am trying to do generally in case there could be a different approach.

I am trying to create a "phyllotaxis" pattern generator that takes an input curve C (flat on the X and Z axes). Imagine that Curve C describes a 3D shape when rotated around the Z axis. The geometry nodes distributes points evenly on that 3D surface in a phyllotaxis pattern.

The math is all from this paper "The use of positional information in the modeling of plants" (Prusinkiewicz et al., 2001). I've got the whole thing implemented in Geometry Nodes except for the one step described above. Here's a slide to summarize the process, and the red box is the step I'm stuck on:

enter image description here

I successfully created an attribute with the cumulative Area divided by "petal" area. Now, when Area is greater than an integer, I want to place a new point (one point = one "petal") at that position. That is where I am super stuck because Blender Geometry nodes doesn't make it easy to make "for" loops!

enter image description here

Thank you in advance for any help or suggestions at all. This node setup would be incredibly useful for generating all sorts of plants and organic type structures. All you would need to do is change the input curve, "petal" size, and instance your petals on each point.

Here is the blend file if you want to see the current node setup:

And finally it would end up looking something like this, but with the balls/petals evenly spaced:

enter image description here

Solution by Markus von Broady (see replies)

I used the solution by Markus von Broady to complete the node tree! Here is the portion that I added at the end:

enter image description here

And the result is, now you can make all sorts of shapes by tweaking the input curve and the petal radius!

enter image description here enter image description here

Here's the final blend file:

$\endgroup$
0

2 Answers 2

8
$\begingroup$

Very similar to Hulifier's solution, who has beat me to it, just small changes: spawning triangles is I think faster, the mesh line can already spawn with Z positions equal to indices, and I think the indices he calculates are wrong, because you need to either capture the indices that spawn triangles, or divide the found index by the number of indices in the spawned geometry (in my case 3, in his case 4) and floor:

Middle column is the result, and side columns are the original geometry and calculated area:

$\endgroup$
1
  • $\begingroup$ You're amazing! It works!!!!!! I'll post an edit with the final product working! $\endgroup$ Commented Jun 18, 2022 at 1:27
8
+100
$\begingroup$

I don't know of any simpler way to get the closest bigger or equal value compared to another value, so this is the way i did:

To get the closest bigger or equal value compared to some value you can use the Raycast node.

The idea is to create a line of faces where the $Z$ coordinate of a face's position is equal to the accumulated area. The resulting geometry can be raycasted using the position $\left (0,0,x\right)$ to get the index of the closest bigger or equal accumulated area compared to $x$.

enter image description here

You can get the index of the closest bigger by requesting the index attribute in the raycast node.

Here I added the idea to the node tree you provided:

enter image description here

$\endgroup$
2
  • 2
    $\begingroup$ Thank you!! I used Marcus von Broady's method ultimately but the picture of the ray cast and how it works was incredibly helpful! $\endgroup$ Commented Jun 18, 2022 at 1:26
  • 1
    $\begingroup$ I also tried using your blendfile and after a few changes it also works! 1. For the raycasting objects I changed the grid square to Mesh Circle node with 3 points (triangles) 2. Added a Divide by 3 node followed by a Floor node to the output of Raycast node. Then the mapping is correct! $\endgroup$ Commented Jun 18, 2022 at 4:12

You must log in to answer this question.

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