Community
Bifrost Forum
Welcome to the Bifrost Forum. This is the place for artists using Bifrost to ask and answer questions, browse popular topics, and share knowledge about creating effects procedurally using Bifrost. You can also visit the Bifrost Community on AREA to download an array of ready-to-use graphs, read Bifrost news and updates, and find the latest tutorials.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Grow point array (similar to grow vertex selection)

7 REPLIES 7
SOLVED
Reply
Message 1 of 8
hazmondo
423 Views, 7 Replies

Grow point array (similar to grow vertex selection)

Hello,

 

I am taking my first steps into Bifrost and I'm trying create a graph that, given indices and an mapping array similar to update_point_neighbors.point_neighbors, can grow the original array containing the indices.

 

As an example, let's say I have the below mesh structure:

0 - 1 - 2

|     |    |

3 - 4 - 5

|     |    |

6 - 7 - 8

then we would have a point_neighbors array like:

[(1, 3), (0, 2, 4), (1, 5),

 (0, 4, 6), (1, 3, 5, 7), (2, 4, 8),

 (3, 7), (4, 6, 8), (5, 7)]

 

I have written python code which gives me the result I want

 

 

point_neighbors_list = [[1, 3], [0, 2, 4], [1, 5],
                        [0, 4, 6], [1, 3, 5, 7], [2, 4, 8],
                        [3, 7], [4, 6, 8], [5, 7]]
indices_to_use = [0, 2]
iterations = 1

for i in range(iterations):
    for j in range(len(indices_to_use)):
        index = indices_to_use[j]
        point_neighbors = point_neighbors_list[index]
        for point_neighbor in point_neighbors:
            if point_neighbor not in indices_to_use:
                indices_to_use.append(point_neighbor)

 

 

So when the points are 0 and 2 (the top left corner and top right corner, respectively) and we grow the point array with one iteration we get [0, 2, 1, 3, 5]

 

I have attached some images of the graph I have created, I expect the same output as the code but the array is not updated and the original indices are output, in this case; 0, 2.

 

I thought I was making a mistake with the port state of the indices_in port but changing it from false to true hasn't worked, any help would be greatly appreciated

 

0_array_setup.PNG1_iterations.PNG2_neighboring_indices.PNG3_check_if_in_array.PNG

LinkedIn: linkedin.com/pub/harry-houghton/51/20a/707
Website: hhoughton07.wix.com/hazmondo
Vimeo: vimeo.com/user9745086
YouTube: youtube.com/user/Hazmondo/videos
Twitter: twitter.com/Haz_Houghton
Facebook: facebook.com/harry.houghton.5
7 REPLIES 7
Message 2 of 8
hazmondo
in reply to: hazmondo

Edit 1: an image was attached, now it's inserted into the first post

 

Edit 2: I realize that the array dimensions in the first picture are not correct, it's not 9 x 2 but it is a 2-dimensional array; each index is a 1-dimensional array of 2, 3 or 4 indices

LinkedIn: linkedin.com/pub/harry-houghton/51/20a/707
Website: hhoughton07.wix.com/hazmondo
Vimeo: vimeo.com/user9745086
YouTube: youtube.com/user/Hazmondo/videos
Twitter: twitter.com/Haz_Houghton
Facebook: facebook.com/harry.houghton.5
Message 3 of 8

If you're able to share a scene file or graph it's a bit easier to find the problem, although since you're using published compounds you'd have make those compounds editable first so they're included in the graph.

 

I can also highly recommend the print pack for debugging these sorts of issues.

Message 4 of 8

The scene was done at work, I wasn't using any custom compounds so I should be able to recreate it at home and then I'll upload the file

LinkedIn: linkedin.com/pub/harry-houghton/51/20a/707
Website: hhoughton07.wix.com/hazmondo
Vimeo: vimeo.com/user9745086
YouTube: youtube.com/user/Hazmondo/videos
Twitter: twitter.com/Haz_Houghton
Facebook: facebook.com/harry.houghton.5
Message 5 of 8
hazmondo
in reply to: hazmondo

I've attached the scene file containing the Bifrost graph

LinkedIn: linkedin.com/pub/harry-houghton/51/20a/707
Website: hhoughton07.wix.com/hazmondo
Vimeo: vimeo.com/user9745086
YouTube: youtube.com/user/Hazmondo/videos
Twitter: twitter.com/Haz_Houghton
Facebook: facebook.com/harry.houghton.5
Message 6 of 8

I've fixed it for you.

Message 7 of 8

Thanks, I haven't had time to check the scene file but I assume it's correct

LinkedIn: linkedin.com/pub/harry-houghton/51/20a/707
Website: hhoughton07.wix.com/hazmondo
Vimeo: vimeo.com/user9745086
YouTube: youtube.com/user/Hazmondo/videos
Twitter: twitter.com/Haz_Houghton
Facebook: facebook.com/harry.houghton.5
Message 8 of 8
hazmondo
in reply to: hazmondo

Thanks,

 

I've tested it and it seems to be working, now I just need to understand what you did 😛

LinkedIn: linkedin.com/pub/harry-houghton/51/20a/707
Website: hhoughton07.wix.com/hazmondo
Vimeo: vimeo.com/user9745086
YouTube: youtube.com/user/Hazmondo/videos
Twitter: twitter.com/Haz_Houghton
Facebook: facebook.com/harry.houghton.5

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report