Hi, is there a vex function (or node) that finds the closest PRIMITIVES to a specified point position? Something that looks within a certain distance? I need to find multiple primitives...not just one.
Thanks,
TheDude123
Hi, is there a vex function (or node) that finds the closest PRIMITIVES to a specified point position? Something that looks within a certain distance? I need to find multiple primitives...not just one.
Thanks,
animatrix_TheDude123
Hi, is there a vex function (or node) that finds the closest PRIMITIVES to a specified point position? Something that looks within a certain distance? I need to find multiple primitives...not just one.
Thanks,
There is no single function that can return multiple nearest primitives but you can use xyzdist iteratively and use adhoc group to continuously exclude the previously found prims as you go, but it will be slow depending on how many primitives you want to gather as each call with a changing adhoc group will rebuild the acceleration data structures.
TheDude123
I see, bummer. Thanks for the info. I'll try the xyzdist method. I have ~50,000 points to loop over and find their nearest prims within a given radius.
So, each point will probably find 3-5 prims. Not sure how slow that's going to be.
TheDude123
Here is an example of what I'm trying to do:
This will be looped over ~50,000 points
TheDude123
Thanks everyone for the help! I'm running into another issue though: I've found an attribute on the points (of the primitives found) and I'd like to store those values into an array of values (they are float values, btw). I can't seem to find a function that will do this. Basically, create an array from an attribute that exists on multiple points (and has different float values).
Example:
point0 f@attribute = 2.3
point1 f@attribute = 73.3
point2 f@attribute = 54.34
point3 f@attribute = 22.6
point4 f@attribute = 5.3
point5 f@attribute = 67.3
create array {2.3, 73.3, 54.43, 22.6, 5.3, 67.3}
Any suggestions?
float vals [ ] = array ( ); int pts [ ] = array ( 1, 2, 3 ); foreach ( int pt; pts ) { float val = point ( 0, "attrib", pt ); append ( vals, val ); }
animatrix_TheDude123
Thanks everyone for the help! I'm running into another issue though: I've found an attribute on the points (of the primitives found) and I'd like to store those values into an array of values (they are float values, btw). I can't seem to find a function that will do this. Basically, create an array from an attribute that exists on multiple points (and has different float values).
Example:
point0 f@attribute = 2.3
point1 f@attribute = 73.3
point2 f@attribute = 54.34
point3 f@attribute = 22.6
point4 f@attribute = 5.3
point5 f@attribute = 67.3
create array {2.3, 73.3, 54.43, 22.6, 5.3, 67.3}
Any suggestions?
What you are looking for is a pointmany VEX function. It doesn't exist. There is an RFE for this: SESI #19043. Submit an RFE and reference this number so they can bump it up.
For now you have to do it manually:float vals [ ] = array ( ); int pts [ ] = array ( 1, 2, 3 ); foreach ( int pt; pts ) { float val = point ( 0, "attrib", pt ); append ( vals, val ); }
TheDude123animatrix_TheDude123
Thanks everyone for the help! I'm running into another issue though: I've found an attribute on the points (of the primitives found) and I'd like to store those values into an array of values (they are float values, btw). I can't seem to find a function that will do this. Basically, create an array from an attribute that exists on multiple points (and has different float values).
Example:
point0 f@attribute = 2.3
point1 f@attribute = 73.3
point2 f@attribute = 54.34
point3 f@attribute = 22.6
point4 f@attribute = 5.3
point5 f@attribute = 67.3
create array {2.3, 73.3, 54.43, 22.6, 5.3, 67.3}
Any suggestions?
What you are looking for is a pointmany VEX function. It doesn't exist. There is an RFE for this: SESI #19043. Submit an RFE and reference this number so they can bump it up.
For now you have to do it manually:float vals [ ] = array ( ); int pts [ ] = array ( 1, 2, 3 ); foreach ( int pt; pts ) { float val = point ( 0, "attrib", pt ); append ( vals, val ); }
ooooooooh, thats interesting.
It looks like the 'manual' part, besides the writing of the code, is I have to input the amount of points into:
int pts = array(manually input here) correct???
Something likes this seems to work as well:
f@vals = array();
int pts = expandpointgroup(0, "");
foreach(int pt; pts){
float val = point(0, 'angle_diff_C', pt);
append(@vals, val);
}
expandpointgroup ( 0, "" ); expandpointgroup ( 0, "*" );
tamte
Not sure how is expandpointgroup() gonna help in your case
If you say you found some prims and now want attrib array of all points of one or all of those prims then it's more like you need to use primpoints() to get array of points per prim
TheDude123To me it sounded like you wanted to get closest prims within radius and then get points of those found prims and get the attrib value array from them, that's why I suggested primpoints()
I wasn't sure what you meant by this
tamteTheDude123To me it sounded like you wanted to get closest prims within radius and then get points of those found prims and get the attrib value array from them, that's why I suggested primpoints()
I wasn't sure what you meant by this
But whatever works for your particular case, since it's not very clear to me what exactly you were trying to get
TheDude123
Thanks everyone for the help! I'm running into another issue though: I've found an attribute on the points (of the primitives found) and I'd like to store those values into an array of values (they are float values, btw). I can't seem to find a function that will do this. Basically, create an array from an attribute that exists on multiple points (and has different float values).
Example:
point0 f@attribute = 2.3
point1 f@attribute = 73.3
point2 f@attribute = 54.34
point3 f@attribute = 22.6
point4 f@attribute = 5.3
point5 f@attribute = 67.3
create array {2.3, 73.3, 54.43, 22.6, 5.3, 67.3}
Any suggestions?
animatrix_TheDude123
Hi, is there a vex function (or node) that finds the closest PRIMITIVES to a specified point position? Something that looks within a certain distance? I need to find multiple primitives...not just one.
Thanks,
There is no single function that can return multiple nearest primitives but you can use xyzdist iteratively and use adhoc group to continuously exclude the previously found prims as you go, but it will be slow depending on how many primitives you want to gather as each call with a changing adhoc group will rebuild the acceleration data structures.
float closestPrimDist = xyzdist(1, @P, closestPrim, closestUV); float secClosestPrimDist = xyzdist(1, '!closestPrim', @P, secondClosestPrim, secondClosestUV)
TimOrSomethinganimatrix_TheDude123
Hi, is there a vex function (or node) that finds the closest PRIMITIVES to a specified point position? Something that looks within a certain distance? I need to find multiple primitives...not just one.
Thanks,
There is no single function that can return multiple nearest primitives but you can use xyzdist iteratively and use adhoc group to continuously exclude the previously found prims as you go, but it will be slow depending on how many primitives you want to gather as each call with a changing adhoc group will rebuild the acceleration data structures.
Hey, I just need the second closest prim but can't figure out the syntax of how to add the closest prim into the group to ignore. I tried something like this but wasn't working haha.float closestPrimDist = xyzdist(1, @P, closestPrim, closestUV); float secClosestPrimDist = xyzdist(1, '!closestPrim', @P, secondClosestPrim, secondClosestUV)
Any help would be appreciated
Thanks
int closestPrim = -1; vector closestUV = 0; float closestPrimDist = xyzdist(1, @P, closestPrim, closestUV); string excludeprim = "!" + itoa ( closestPrim ); int secondClosestPrim = -1; vector secondClosestUV = 0; float secClosestPrimDist = xyzdist(1, excludeprim, @P, secondClosestPrim, secondClosestUV);
animatrix_TimOrSomethinganimatrix_TheDude123
Hi, is there a vex function (or node) that finds the closest PRIMITIVES to a specified point position? Something that looks within a certain distance? I need to find multiple primitives...not just one.
Thanks,
There is no single function that can return multiple nearest primitives but you can use xyzdist iteratively and use adhoc group to continuously exclude the previously found prims as you go, but it will be slow depending on how many primitives you want to gather as each call with a changing adhoc group will rebuild the acceleration data structures.
Hey, I just need the second closest prim but can't figure out the syntax of how to add the closest prim into the group to ignore. I tried something like this but wasn't working haha.float closestPrimDist = xyzdist(1, @P, closestPrim, closestUV); float secClosestPrimDist = xyzdist(1, '!closestPrim', @P, secondClosestPrim, secondClosestUV)
Any help would be appreciated
Thanks
Hi,
You can do it like this:int closestPrim = -1; vector closestUV = 0; float closestPrimDist = xyzdist(1, @P, closestPrim, closestUV); string excludeprim = "!" + itoa ( closestPrim ); int secondClosestPrim = -1; vector secondClosestUV = 0; float secClosestPrimDist = xyzdist(1, excludeprim, @P, secondClosestPrim, secondClosestUV);
Just passing closestPrim as an adhoc group won't work because a primitive group with that name doesn't exist. If you create that group in the same wrangle, then you would have to do the second lookup using another wrangle that comes after so it can find it.
JikianTheDude123
Thanks everyone for the help! I'm running into another issue though: I've found an attribute on the points (of the primitives found) and I'd like to store those values into an array of values (they are float values, btw). I can't seem to find a function that will do this. Basically, create an array from an attribute that exists on multiple points (and has different float values).
Example:
point0 f@attribute = 2.3
point1 f@attribute = 73.3
point2 f@attribute = 54.34
point3 f@attribute = 22.6
point4 f@attribute = 5.3
point5 f@attribute = 67.3
create array {2.3, 73.3, 54.43, 22.6, 5.3, 67.3}
Any suggestions?
Attribute Promote (to Detail), "Array of All"?