Jump to content

how to find out if there's other geometry intersecting with the li


oat

Recommended Posts

Since this is Houdini we're talking about, there's probably a million ways to do it all of which are correct. I'd use an Add SOP to make a line between the two points, use the Resample SOP to make a bunch of points between the two, use an Attribute Transfer SOP and Attribute Create SOP to transfer whatever attribute you want onto potential objects in between, then lastly use Attribute Promote SOP (and maybe a For Each SOP) to push the point attribute to groups or whatever is needed. Also useful might be the Ray SOP which is a completely different way of solving the problem.

Edited by lukeiamyourfather
Link to comment
Share on other sites

My first thought would be to test using some sort of ray. In the attached file there are two examples of using the Ray SOP or a VOP SOP using Intersect. A vector is computed from pt0 to pt1 and is used as the ray direction. In the case of the Ray SOP, if the dist point attr is > 0 then there is something in the way. In the case of the VOP setup if the hit attr is not -1 then there has been a collision.

ray_test_intersections.hip

Link to comment
Share on other sites

My first thought would be to test using some sort of ray. In the attached file there are two examples of using the Ray SOP or a VOP SOP using Intersect. A vector is computed from pt0 to pt1 and is used as the ray direction. In the case of the Ray SOP, if the dist point attr is > 0 then there is something in the way. In the case of the VOP setup if the hit attr is not -1 then there has been a collision.

dear graham, thanks a lot!

will take some time to digest the approach you suggested.

Link to comment
Share on other sites

My first thought would be to test using some sort of ray. In the attached file there are two examples of using the Ray SOP or a VOP SOP using Intersect. A vector is computed from pt0 to pt1 and is used as the ray direction. In the case of the Ray SOP, if the dist point attr is > 0 then there is something in the way. In the case of the VOP setup if the hit attr is not -1 then there has been a collision.

dear graham, thank you very much!

It seems the "ray" method works fine, but the pure VOP SOP method doesn't work in certain situation as shown in the attached hip file.

In the hip file one of the point is inside a box but the dist value obtained is zero.

can you kindly help to take a look and suggest a solution?

BTW, tamte posted almost the same method as yours in the Houdini apprentice forum for the same question I post here:

http://www.sidefx.com/index.php?option=com_forum&Itemid=172&page=viewtopic&p=101656#101656

Thank you in advance!

post-5328-130037192301_thumb.png

Edited by oat
Link to comment
Share on other sites

Sorry, that is my bad. The VOP SOP method works fine, however the Ray SOP doesn't. I accidentally left an incorrect value for the Max Ray Dist. It should be length($NX, $NY, $NZ) instead of just $NX.

Attached is the VOP method wrapped in an asset. It provides a more straight forward boolean as to whether or not an intersection exists, as well as a bit more information about any intersection that might be occurring.

sop_lineintersection.otl

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...