0
$\begingroup$

to simplify, I have a set of points laid out like this and I want to be able to connect them with a line or a curve based on a certain index offset, for example: connecting index i with index i+1 only if i is an odd number: so 1 would connect with 2, 3 with 4, 5 with 6 and 7 with 0. (but NOT 2 with 3 for example)

here's what I would like to achieve:

enter image description here

This looks extremely simple but i've been stuck on it for a few days, I can't seem to wrap my head around it, the indices keep changing especially when I instance the lines and realize them: the i and i+1 attributes that I captured before change when the lines are added, so the results become unpredictable. any help will be much much appreciated.

Update: the workaround I'm using meanwhile is I add a circle with as many points as there are in the input geometry, and I set poistion of the circle's points to match the input points. then I delete the edges with an odd number. this indeed creates the lines between the points but it's not ideal, as I'm planning to add parameters to the lines between the points. so a solution that involves instancing mesh lines or curve lines would be perfect.

enter image description here

$\endgroup$

1 Answer 1

2
$\begingroup$

Here is a geometry nodes setup that creates edges between every other vertex: Geometry nodes setup creating a mesh circle based on the indexes of vertices from an input geometry and then removing every other edge

If you want to support both an odd and even amount of vertices this version ignores the last uneven vertex: Geometry nodes setup creating a mesh circle based on the indexes of vertices from an input geometry and then removing edges who's starting index is odd or where the ending index is 0

$\endgroup$
3
  • $\begingroup$ Wow, thank you ! I had just realized I could do it with a mesh circle and I read your answer, great timing hahah, is it possible to do it by instancing a line or a curve tho ?? that would be ideal for me, if not, then is there a way to take those edges and convert them to a curve or make them bend inward or outward ?? Thank you so much for your answer. $\endgroup$ Commented Mar 4, 2023 at 14:39
  • $\begingroup$ You can use the Mesh to Curve node to convert the edges to curves and then modify them like you would any other curve. $\endgroup$ Commented Mar 4, 2023 at 14:51
  • $\begingroup$ you're right, I did that and it worked, but I went with subdivide mesh instead and it's giving me more control, thanks again :) $\endgroup$ Commented Mar 4, 2023 at 15:21

You must log in to answer this question.

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