sprawd Posted June 2, 2007 Share Posted June 2, 2007 (edited) 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 June 2, 2007 by sprawd Quote Link to comment Share on other sites More sharing options...
Jason Posted June 2, 2007 Share Posted June 2, 2007 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 " " Quote Link to comment Share on other sites More sharing options...
sprawd Posted June 3, 2007 Author Share Posted June 3, 2007 (edited) 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 June 3, 2007 by sprawd Quote Link to comment Share on other sites More sharing options...
sibarrick Posted June 3, 2007 Share Posted June 3, 2007 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 Quote Link to comment Share on other sites More sharing options...
sprawd Posted June 3, 2007 Author Share Posted June 3, 2007 (edited) If you want all points that are in the same position try thisuse 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 June 3, 2007 by sprawd Quote Link to comment Share on other sites More sharing options...
sibarrick Posted June 4, 2007 Share Posted June 4, 2007 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. Quote Link to comment Share on other sites More sharing options...
grasshopper Posted June 4, 2007 Share Posted June 4, 2007 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.