Jump to content
Sign in to follow this  
sprawd

About Array Data..

Recommended Posts

I want to use expression to check if certain piont's tx value between two nodes is same.

But I dont konw how to handle the array data in expressions..

expression like this:

float findpoint(string pathf, string pathc)

{

float att = 0;# att[] doesnot work!!, Can I claim a array data explicitly?

float numberf = npoints(pathf);

float numberc = npoints(pathc);

for(float i=0; i<numberc;i++)

{

float txc = point( pathc, i, "P",0);

for(float j=0; j<numberf;j++)

{

float txf = point (pathf, j,"P",0);

if(txc == txf)

{

att =1;

break;#how to append elements into this array?

}

}

}

return att;#Finally, how to assign this array data to correlative point?

}

thank for your help.

Edited by sprawd

Share this post


Link to post
Share on other sites

Hi there,

hscript or expression language doesn't have support for arrays, but you might be able to stuff numbers into a string - space delimited - and access the values with arg(string,index).

For example:

set poo = ""
for i = 1 to 10
  set poo = "$poo $i"   #append to string
next

echo "fifth element is: "+arg($poo,4)

Hope this helps a bit,

Jason

PS. This will be easier in Houdini 9 since you'd do this with Python.

PPS. When posting code in the forum, you can use the BBCode "

"

Share this post


Link to post
Share on other sites

thank your very much.

I use nearpoint() to do the job I mentioned before:

"

"

$PT==nearpoint("../vertexsplit1",point("../splitpoints","$PT","P",0),

point("../splitpoints","$PT","P",1),

point("../splitpoints","$PT","P",2))

"[code]"

I use this expression in group SOP, hoping to select all the points

which position are identical with the counterparts in other node.

but only one point whose position matchs the maximal $PT of "splitpoints" node is returned...

I want to get all matching points, where am I worng?

thanks again.

(sorry, I still dont konw How to type code as you do.....)

Edited by sprawd

Share this post


Link to post
Share on other sites

If you want all points that are in the same position try this

use a point sop and put one version of your geometry into input 1 and the other input 2

then subtract the point positions

$TX-$TX2 $TY-$TY2 $TZ-$TZ2

then in your group sop make a group of points who's position is 0

$TX == 0 && $TY ==0 && $TZ == 0

you can copy this group back to the original geometry using groupCopy sop

hope that helps

Share this post


Link to post
Share on other sites
If you want all points that are in the same position try this

use a point sop and put one version of your geometry into input 1 and the other input 2

then subtract the point positions

$TX-$TX2 $TY-$TY2 $TZ-$TZ2

then in your group sop make a group of points who's position is 0

$TX == 0 && $TY ==0 && $TZ == 0

you can copy this group back to the original geometry using groupCopy sop

hope that helps

Hi sibarrick;

This method does not work, because the id of two geomoeries is not match,

so the result of "$TX-$TX2 $TY-$TY2 $TZ-$TZ2" is unpredictable...

Here is my secen, I want make a fission effect, so I had to select splited points firstly....

sprout.hip

Edited by sprawd

Share this post


Link to post
Share on other sites

Ah, didn't realise, that's gonna make life pretty hard going then, since every point has to be compared with every other point. You could do it in vex using a point cloud that would be quickest, then just add every matching point to a group.

Share this post


Link to post
Share on other sites

Hi sprawd

Here's a method to compare two SOPs to find unique and shared points. I'm assuming this is along the lines of what you were looking for.

This method uses proximity groups in POPs. This will become increasingly inefficient for large numbers of points because a group needs to be created for each point. Also, it is possible that two points that are very very close but not in exactly the same position will be classed as shared by this method. If you want exact matches you'll have to look at a method in vex probably using point clouds.

The proximity groups store the IDs of any neighbouring points found within a very small search radius. This means you can query the proximity group to find the neighbouring shared point (or points) using the pointlist expression.

Hope that helps

John

proximity.hip

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×