Jump to content

Search the Community

Showing results for tags 'arrays'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Lounge/General chat
    • Education
    • Jobs
    • Marketplace
  • Houdini
    • General Houdini Questions
    • Effects
    • Modeling
    • Animation & Rigging
    • Lighting & Rendering
    • Compositing
    • Games
    • Tools (HDA's etc.)
  • Coders Corner
    • HDK : Houdini Development Kit
    • Scripting
    • Shaders
  • Art and Challenges
    • Finished Work
    • Work in Progress
    • VFX Challenge
    • Effects Challenge Archive
  • Systems and Other Applications
    • Other 3d Packages
    • Operating Systems
    • Hardware
    • Pipeline
  • od|force
    • Feedback, Suggestions, Bugs

Found 5 results

  1. Shift Array Vex

    How can I shift values in an array using a for loop? For example: [0,0,0,1,1,1]->[1,0,0,0,1,1] I would think that this code would work but it does not. Any help would be appreciated. for(int j = 0; j < 6; j++ ){ if(@new_tile_array[@new_prim_id] == 1){ break; } else{ int popped = pop(@new_tile_array); append(@new_tile_array,popped); } }
  2. VEX Array Functions

    Harder, Better, Faster, Stronger please! Looking for some voodoo to optimize these snippets... Find Unique Elements in One Array function int[] unique_elements (int arr[]) { int _arr[] = sort(arr); for (int i=0; i<len(_arr); i++) { while(_arr[i] == _arr[i+1]) pop(_arr,i); } return _arr; } Get Duped Elements in One Array function int[] duped_elements (int arr[]) { int _arr[] = sort(arr); int result[] = {}; int dupe; for (int i=0; i<len(_arr); i++) { while(_arr[i] == _arr[i+1]) { dupe = pop(_arr,i); } append(result, dupe); } return result; } Find Common Elements in Two Arrays function int[] common_elements (int arr1[]; int arr2[]) { int result[]; foreach (int i; unique_elements(arr1)) { foreach (int j; unique_elements(arr2)) { if (i==j) push(result,j); } } return result; } Find Different Elements in Two Arrays function int[] different_elements (int arr1[]; int arr2[]) { int result[]; int _arr1[] = unique_elements(arr1); int _arr2[] = unique_elements(arr2); foreach(int i; _arr1) { if(find(_arr2,i)<0) append(result,i); } foreach(int j; _arr2) { if(find(_arr1,j)<0) append(result,j); } return result; } Swap Arrays function int[] swap (int arr1[]; int arr2[]) { int temp[] = arr1; arr1 = arr2; arr2 = temp; return {1}; } Here's some of what I was using to test it... these are all based on arrays of integers but could be tweaked obviously for other types. i[]@arr1 = {3, 2, 15, 27, 1, 3}; i[]@arr2 = {3, 2, 3, 15, 41, 41, 1, 2, 2}; i[]@arr_comm = common_elements (@arr1, @arr2); i[]@arr_diff = different_elements (@arr1, @arr2); i[]@arr_uniq = unique_elements (@arr1); i[]@arr_dupe = duped_elements (@arr2);
  3. I'm new to vex and was wondering if there is a splat operator to unpack arrays into function arguments? (like javascript's ... or rubys *) The reason I'm asking is I have a wrangle that I want to take an unknown number of points and put their position into the cspline function. In the docs we have vector cspline(float t, vector val1, ...) If it was Javascript I'd do something like cspline(t, ...array_of_parameters) to unpack my array into that list of parameters, is it possible to do something similar in vex? If it's not possible how can you get an unknown number of parameters into a function that takes an unknown number of parameters? Cheers Ben
  4. Hi Everyone I'm currently trying to create circular point groups, inside a voronoi fracture. My outputs are groups currently are primitives but when I conver them to points, i have to many clustered together. I'm thinking of a solution by either getting the max/min two points of each primitive inside my group and delete the other points from the group. Unfortunately my VEX skills are very limited, I seem to be declaring my max function wrong. If someone could help me figure it out that would be great, also an explanation to why my attempt didn't work/ any other solutions towards achieving the same result would be more than welcome. Cheers Example.hipnc and for any questions im trying to make a tool that creates ground slams, as you can see there's distinct circular fractures which im trying to replicate, but also make procedural.
  5. Hi, If I use an attribute wrangle to create an array attribute and populate the array like so: i[]@stuff = nearpoints (0, @ape, 1, 23); I can then slice the array like so: i@branch = @stuff[3]; and all is good in the world. However, if I attach another wrangle node and try to use the same slice, I get an error even though the array attribute shows up in the spreadsheet? Not a showstopper but I'd love to know why the attribute isn't accessible.
×