barad_dur Posted July 2, 2012 Share Posted July 2, 2012 (edited) Hey all, I would like to get the average of all the Y velocities of a group of points inside a foreach SOP. I am really trying to find out if a rotating object (out of a whole bunch of other, differentially rotating objects) is going up on average based on all the points that make it up. How might I go about getting all the Y velocities to add up and then return the average? Each object will have a different amount of points so I was figuring I would use a forloop inside a vopsop inside the foreach using the total number of points as the number to iterate through when adding the Y's up and then use it as the dividing number but I am hopelessly stuck. Any ideas? Thank you, David Edited July 2, 2012 by barad_dur Quote Link to comment Share on other sites More sharing options...
jkunz07 Posted July 2, 2012 Share Posted July 2, 2012 (edited) Are you looking for the average of only the Y component of the velocities? Or the Y component of the average of all the velocities? Edited July 2, 2012 by jkunz07 Quote Link to comment Share on other sites More sharing options...
bloomendale Posted July 2, 2012 Share Posted July 2, 2012 Just promote v attrib to detail with "Average". If you have several groups of points, use Connectivity node and then ForEach SOP with "per attrib value" and promote v inside foreach. Quote Link to comment Share on other sites More sharing options...
3dbeing Posted July 2, 2012 Share Posted July 2, 2012 (edited) *** woops looks like it was already answered... Edited July 2, 2012 by 3dbeing Quote Link to comment Share on other sites More sharing options...
chiess Posted June 3, 2013 Share Posted June 3, 2013 Hi, I know this thread is super old, but unfortunately it doesn't help me in answering one simple question: How do I find/access/read one single velocity value of a point. For example, I only want to read the v[y] value. If I use v in my expression, it only returns v[x], but how do I access the other 2 velocity directions? v[x], v[y], etc. doesnt work somehow I promoted the point velocity into a detail attribute, which still results in 3 detail attributes (x, y, z). detail("../attribpromote1", "v[y]", 0) just doesn't work and always returns 0. And somehow, I just can't find ANY documentation about this simple issue anywhere . Thanks, Chris Quote Link to comment Share on other sites More sharing options...
jkunz07 Posted June 3, 2013 Share Posted June 3, 2013 I think: detail("../attribpromote1", "v[y]", 0) should be detail("../attribpromote1", "v", 1) the last argument of the detail expression is the attrib index and is where you specify you want the y component Quote Link to comment Share on other sites More sharing options...
chiess Posted June 3, 2013 Share Posted June 3, 2013 Hi jkunz07, Jep that worked, thanks a lot! Do you also know why the attribute P (position) is not working to get promoted as a detail? Thanks again! Quote Link to comment Share on other sites More sharing options...
jkunz07 Posted June 4, 2013 Share Posted June 4, 2013 I tried promoting P in a file and it seemed to work ok for me, maybe post your file where your having trouble with it? Are you having trouble with specifically promoting P or referencing it in a detail expression? If all else fails you can use fuse sop with a really high threshold to slam all the points together. Reference the fuse sop with point("../fuse1", 0, "P", 1) for the avg Y position. Quote Link to comment Share on other sites More sharing options...
chiess Posted June 4, 2013 Share Posted June 4, 2013 I've attached a very simple setup, containing a point grid and an attribute-promote node. I am trying to promote P from points to a detail attribute. Unfortunately, they position attributes don't appear as details. (It worked fine with velocity etc.) Thanks! promoteP.hip Quote Link to comment Share on other sites More sharing options...
jkunz07 Posted June 4, 2013 Share Posted June 4, 2013 I've attached a very simple setup, containing a point grid and an attribute-promote node. I am trying to promote P from points to a detail attribute. Unfortunately, they position attributes don't appear as details. (It worked fine with velocity etc.) Thanks! Looks like it's working for me. If you rename "P" to "pos" in attributepromote then the detail expression has to change from "P" to "pos" as well. promoteP_060413.hip Quote Link to comment Share on other sites More sharing options...
chiess Posted June 4, 2013 Share Posted June 4, 2013 Strange, it doesn't seem to work for me, even with your file. The node attribpromote1 doesn't have any detail information (when you check in Detail View) and the node detail_expression seems to output wrong values. All 3 results show 0. y-pos should show at least 5. Is this different in your Houdini? Quote Link to comment Share on other sites More sharing options...
jkunz07 Posted June 4, 2013 Share Posted June 4, 2013 Strange, it doesn't seem to work for me, even with your file. The node attribpromote1 doesn't have any detail information (when you check in Detail View) and the node detail_expression seems to output wrong values. All 3 results show 0. y-pos should show at least 5. Is this different in your Houdini? Yeah, mine has meaningful values H12.5.351 OSX What build, platform are you on? Quote Link to comment Share on other sites More sharing options...
chiess Posted June 5, 2013 Share Posted June 5, 2013 I am using H12.1 Build 185, Windows Vista Quote Link to comment Share on other sites More sharing options...
anim Posted June 5, 2013 Share Posted June 5, 2013 (edited) I am using H12.1 Build 185, Windows Vista you would need to update after 12.5.122 Wednesday, August 1, 2012 Houdini 12.5.122: The Attribute Promote SOP will promote the P attribute as expected. Or just rename P to pos(or whatever) prior to Attribute Promote SOP to promote it promoteP_mod.hip Edited June 5, 2013 by anim Quote Link to comment Share on other sites More sharing options...
chiess Posted June 5, 2013 Share Posted June 5, 2013 Ah, ok, so it was really a Houdini bug. Thanks Tomas! 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.