How to calculate point distance within a geometry?

   14910   7   2
User Avatar
Member
25 posts
Joined: July 2007
Offline
I want to calculate the distance of “current” point with its "previous' point and store the result in a custom point attribute for each point, but how could I access the position of ‘other’ points? Something like P-x?

Hope it make sense..

Thanks in advanced.
User Avatar
Member
1145 posts
Joined: July 2005
Offline
Do a search in the help browser for “opinput”, to see an example.
“gravity is not a force, it is a boundary layer”
“everything is coincident”
“Love; the state of suspended anticipation.”
User Avatar
Member
25 posts
Joined: July 2007
Offline
Hi, thanks for the reply. And I read the help file, didn't quite get it…May be I didn't say clearly what my problem is. As an example, I have a sphere, I want to create a point attribute to store the distance between pt1 and pt2, pt 2 and pt 3, pt 3 and pt 4, etc. for each pt 1, 2, 3… of that sphere respectively .

Sorry for my bad English.
User Avatar
Member
321 posts
Joined: July 2005
Offline
Takeshi
Hi, thanks for the reply. And I read the help file, didn't quite get it…May be I didn't say clearly what my problem is. As an example, I have a sphere, I want to create a point attribute to store the distance between pt1 and pt2, pt 2 and pt 3, pt 3 and pt 4, etc. for each pt 1, 2, 3… of that sphere respectively .

Sorry for my bad English.
There are a couple of ways to do this: send your input into a point SOP's left input; send your input into a sort SOP, and shift your points by 1, and send the output of that into the right hand input of the point SOP. Inside the point SOP, use either the distance() or length() function (don't have Houdini open in front of me) as in:

length($TX,$TY,$TZ,$TX2,$TY2,$TZ2)

If instead,you want the distance in time to the previous frame, use a trail SOP with ‘calculate velocity’, and then multiply those by $FPS.

– Antoine
Antoine Durr
Floq FX
antoine@floqfx.com
_________________
User Avatar
Member
25 posts
Joined: July 2007
Offline
Hi, Antoine, your suggestion works fine. Thanks a lot. Though I wonder why it is possible to refer to the position directly like “position of $PT5” or “position of $PT(x-1)” . It will be much convenient.

Cheers
User Avatar
Member
321 posts
Joined: July 2005
Offline
Takeshi
Hi, Antoine, your suggestion works fine. Thanks a lot. Though I wonder why it is possible to refer to the position directly like “position of $PT5” or “position of $PT(x-1)” . It will be much convenient.

Cheers
Most likely because internally, the data is processed sequentially, so when it's working on point #23, Houdini no longer has knowledge of what that point was. That being said, you can use a point() function to get the value of point #22 or #24, but you have to do it of a SOP that is *not* the current SOP.

– Antoine
Antoine Durr
Floq FX
antoine@floqfx.com
_________________
User Avatar
Member
25 posts
Joined: July 2007
Offline
I see, so I could do my own calculation with the point() expression too. I would try that out too. Thanks for the explanation. Much appreciated.

Cheers
User Avatar
Staff
2540 posts
Joined: July 2005
Offline
Use VEX/VOPs.

Attachments:
vop_sop_subtract_point.hip (41.7 KB)

There's at least one school like the old school!
  • Quick Links