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.
How to calculate point distance within a geometry?
14911 7 2- Takeshi
- Member
- 25 posts
- Joined: July 2007
- Offline
- probbins
- Member
- 1145 posts
- Joined: July 2005
- Offline
- Takeshi
- 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.
Sorry for my bad English.
- Antoine Durr
- Member
- 321 posts
- Joined: July 2005
- Offline
TakeshiThere 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:
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.
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
- Takeshi
- Member
- 25 posts
- Joined: July 2007
- Offline
- Antoine Durr
- Member
- 321 posts
- Joined: July 2005
- Offline
TakeshiMost 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.
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
– Antoine
- Takeshi
- Member
- 25 posts
- Joined: July 2007
- Offline
- old_school
- Staff
- 2540 posts
- Joined: July 2005
- Offline
-
- Quick Links