Bifrost Nodegraph - average of an array coords

Bifrost Nodegraph - average of an array coords

Anonymous
Not applicable
936 Views
4 Replies
Message 1 of 5

Bifrost Nodegraph - average of an array coords

Anonymous
Not applicable

Hi Everyone,

my first post here. I approched to Bifrost just few weeks ago, and I have a question: how can I obtain the average of an array that contain coords?

I have 2 intersecting objects, a vertical plane and an horizontal cylinder to create an irregular section. I want to track the nearest point of the plane on the cylinder surface, obtaining a single point as average and next using it to set translations of another geometry. At this time I've solved only the problem about projecting point on the surface (see attachment). I've not found a node that return an average, so I think the best way is to use an iteration after my sample property node. I've just watched the tutorial by Jonah Friedman (https://forums.autodesk.com/t5/bifrost-forum/introduction-to-bifrost-iteration-tutorial/td-p/8949069) but I can't get it work, maybe I am missing something. Please, someone could help me to connect properly nodes inside the iteration or suggest other solution?

Best.

Giulio.bifrost_average_v01.JPG

Accepted solutions (1)
937 Views
4 Replies
Replies (4)
Message 2 of 5

mjcg91
Collaborator
Collaborator
Accepted solution

To get the average value of an array, you must sum the array's elements, and divide the result by the array's size.

array_average.jpg

Maxime Jeanmougin - Technical Artist
https://maximejeanmougin.com

Join the Bifrost Addicts community on Discord:
https://discord.gg/bifrost-addicts
Message 3 of 5

Anonymous
Not applicable

Hi, thank you for your prompt response, but I have some problems to get it work (see attachment)

I added a watchpoint and I see there are no data inside it.

Thanks in advance

bifrost_average_v02.JPG

0 Likes
Message 4 of 5

mjcg91
Collaborator
Collaborator

This is because construct_points takes an array as input, and not a single value. If you pay attention, you can see that the input port on construct_points is hat shaped, which means that it is an array.

To make this work, you can use "build_array" before "construct_strands". Alternatively, you can right click on the point_position port, check "Fan-in", and then plug the value coming from the divide node.

Maxime Jeanmougin - Technical Artist
https://maximejeanmougin.com

Join the Bifrost Addicts community on Discord:
https://discord.gg/bifrost-addicts
0 Likes
Message 5 of 5

Anonymous
Not applicable

Thank your help! now it works.

0 Likes