2
$\begingroup$

I have generated some random points on the xy plane. I want to connect a spline to the closest pairs but not having more than 1 spline connected any one point. I have used the "Find Close Points" node as it gives a list of all the closest points in order when used in conjunction with "Sort Numbers" node. I know that I should use the two elements of the first tuple at index zero and remove any tuples that had either the two elements in them and then removed tuples that have the either of the two elements at index 1 etc. Been trying all day with no joy hope someone can help. Would be great for loop node and script node example to compare! Thank you! Using animation nodes 2.2 Blender 2.93 beta

enter image description here

$\endgroup$
4
$\begingroup$

Here is the node tree:

The tricky part for me was the "recursion" which AN does with this reassign parameter.

enter image description here

and here is the result in action: https://youtu.be/9Fdx1kxaJgE

$\endgroup$
4
  • $\begingroup$ I posted an answer to my own question which achieved the same result in a different way. I posted both blend files. Is it bad form to mark my answer as the answer as it is more exactly done how I described in the question. Iterating over the sorted edge indice list. I built your node tree and got the required results and it inspired me to do recursive over edge indices. Took ages but I learnt a lot about the loop nodes. If I mark it as answered will that stop other people being able to add their own answers? $\endgroup$ May 18 at 4:10
  • $\begingroup$ no, they still can answer. But why don't you want to learn from other people's answers? Of course you can mark your own answer as "the right" one. And looks like you do this not for the first time...but maybe you should also think about the time and effort other people put into this to help YOU. And by marking your answer as the right one is ...a little bit...sad. But...your decision. And it would show a bit respect if you don't mark your own answer - maybe you want again help. And maybe then some people won't help, if you just mark your answers as correct. $\endgroup$
    – Chris
    May 18 at 4:20
  • $\begingroup$ Ok fair enough I will mark your answer as the answer. I built your tree and will study that try to understand more the remove list element. Check out my blend file below. I was struggling till I built your node tree and got inspired to do it similar way. Two ways to skin a cat. Thankyou I appreciate your answer. $\endgroup$ May 18 at 4:42
  • $\begingroup$ You are welcome $\endgroup$
    – Chris
    May 18 at 4:57
2
$\begingroup$

Following on from Chris's answer which he got the same result in a different way using the distance option in the "Find close points" node. I used the amount option in that node instead. Here is my node tree, enter image description here

Here are the blend files for both Chris and my nodes for comparison. Chris's

Mine

$\endgroup$
1
$\begingroup$

Not sure this is what you looking for. Here elements are sorted based on x, you can change that to distances.

enter image description here

$\endgroup$
3
  • $\begingroup$ i think he wants the distance. Not the x-values sorted. And i think then the node tree isn't that easy, because find Close Points returns not such an easy to handle array....but....surprise me! ;) i am curious $\endgroup$
    – Chris
    May 17 at 7:10
  • $\begingroup$ I don't have any other idea. but still feel like there is more simpler way to do this $\endgroup$ May 17 at 10:32
  • $\begingroup$ Yes I wanted the distance. But that node tree is instructive sort by x coordinates thankyou. I posted an answer to my own question which achieved the same result in a different way. I posted both blend files. $\endgroup$ May 18 at 4:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.