Jump to content

VEX or Python Intersect with specific prim?


Daniel

Recommended Posts

Hello, Dusting off my Houdini hat after many many years.  I'm trying to take a set of points and intersect them with a set of triangles.   But I only want each point to intersect a particular corresponding triangle. So I have 500 points and 500 triangles, I'd like  pt1 to only intersect with prim1, pt2 to only intersect prim2.. etc. etc.   I'm generating the triangles in question within a python sop but I don't see a way to intersect a point with the triangle.. I'm not seeing any interaction funcs in the hou py module.  I realize there's a vex intersect but I don't think it allows you to intersect a point against just a specific prim from an input.  I know this can be done in the HDK but I'm just trying to prototype something quickly.  I could do some sort of copy/stamp loop and isolate the point and prims but ideally I don't have to do that.  Any pointers? 

Thanks

Daniel

Link to comment
Share on other sites

Not exactly.  I want to move the point along the normal of the plane defined by the prim.  So imagine my triangle represents and infinite plane with a normal.  I'd want to move the point along that normal until it hits the plane and record the barycentric coord and distance offset to the plane.  So it may miss the triangle completely but it would hit the imaginary plane it defines.  I was going to scale up the triangles really big before the test to "catch" all the intersections but I may just have to code in the math for a line/plane intersection and do that myself

Link to comment
Share on other sites

I might be missing something obvious, but you can check a dot product of vector(point in question, nearest intersection) and normal of a prim. If it equals zero, your point is above a prim, and you have all you need. Home-brew line/plane code also sounds good though. 

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...