Filter neighbour array

   1979   3   0
User Avatar
Member
27 posts
Joined: June 2016
Offline
Hey,

I have a bunch of curves with points and trying to get the start and end of each one.

i@neighbours = neighbours(0, @ptnum);

This gives me a list in an array with some with two values and some with one





etc…

how would I filter only the ones with 1 value in the array? Delete sop for example?

Thanks!
User Avatar
Member
4528 posts
Joined: Feb. 2012
Online
You can use the neighbourcount function and group the ones that return 1.
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]

youtube.com/@pragmaticvfx | patreon.com/animatrix | pragmaticvfx.gumroad.com
User Avatar
Member
918 posts
Joined: March 2014
Offline
Hi,

you could also set the attribute wrangle to Primitives and run the following:

int i[] = primpoints(0,@primnum);

int start = i[0];
int end = i[len(i)-1];

i[]@start_end = {};
@start_end[0] = start;
@start_end[1] = end;

This gives you a primitive attribute for each curve containing an array with the start and end point numbers of that curve.

Hope this helps,

Andy
Edited by Andy_23 - June 29, 2016 08:45:14
User Avatar
Member
27 posts
Joined: June 2016
Offline
neighbourcount worked a charm.

Cheers guys!
  • Quick Links