1
$\begingroup$

Nodes

I want to iterate over every edge and do a math operation on its vertices, but when I use this method, it only works on the vertex with an index of zero. Am I doing something wrong?

$\endgroup$
1
  • $\begingroup$ What are you trying to accomplish? $\endgroup$ Dec 6, 2022 at 15:55

1 Answer 1

1
$\begingroup$

I suspect that's happening because Edge Vertices is working in the Edge domain so the selection doesn't carry over properly. Sticking an Interpolate Domain on Edge mode right after Edge Vertices seems to do something:

enter image description here

However, keep in mind that, as the manual says, the order of the two vertices of an edge is arbitrary. The first vertex of an edge might also be the second vertex of another connected edge, so the end result might not feel very intuitive. In the setup above, there are many more second vertex points than there are first vertex points (424 red spheres to 83 blue cubes), for instance. My guess would be that during the interpolation, when it's time to select the second vertices many of the first ones get switched to the seconds list since as well as being the first vertices of some edges, they're also the second vertices of others. If you used the Vertex Index 2 socket instead of the Boolean Math—Not node like I'm doing, you would see some vertices getting picked twice while others dropped completely.

If what you're trying to do is select every-other vertex and you'd like the proportion to be more balanced, you could use a MathModulo node and set it to $2$ (or whatever integer you like) instead:

enter image description here

$\endgroup$
8
  • $\begingroup$ That explains a lot, but makes me realize I didn't explain my problem more thoroughly. I'm working on 3.5 and trying to make a spring constraint out of the edges of my mesh in a simulation loop. What I need is to loop through every edge, grab its 2 vertices, calculate their distance, and if they're further apart than their original distance then bring them back together or pull them apart. But for this to work, in your example we would need the exact same amount of red spheres to blue cubes (i.e. every edge has exactly two vertices) $\endgroup$
    – Paul S
    Dec 6, 2022 at 16:16
  • $\begingroup$ I don't know if the problem here is how Blender distinguishes points from vertices or if I'm missing something. $\endgroup$
    – Paul S
    Dec 6, 2022 at 16:17
  • 1
    $\begingroup$ Hmm, do you need the indices for that? Wouldn't you do sth like: capture the initial distance between the two vertices of all edges, then capture it again and compare it to the initial value using named attributes and then scale elements? Like: i.imgur.com/fuv1I23.png I might be saying sth silly, not experienced with the simulation branch yet. $\endgroup$
    – Kuboå
    Dec 6, 2022 at 16:25
  • $\begingroup$ There is no difference between points and vertices in terms of domain evaluation, afaik. Vertices are the mesh element that's evaluated in the points domain, along with curve control points, and point clouds. In my scaling setup you would stay in the Edge domain so that wouldn't matter anyways. $\endgroup$
    – Kuboå
    Dec 6, 2022 at 16:42
  • $\begingroup$ That works, but in a simulation context, because the Edge Vertices node mixes up the vertices, it becomes very unstable; some vertices aren't iterated over at all (like shown in your red spheres and blue cubes example). In this image: imgur.com/a/p2XO6rI you can see that when I plug the position 1, the mesh is weirdly distorted. If this node was actually iterating over every edge and applying the operation (i.e. go over edge 1, set v1 position to v1 position) there shouldn't be any change, but there is. $\endgroup$
    – Paul S
    Dec 6, 2022 at 16:45

You must log in to answer this question.

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