Daniel Posted August 30, 2016 Share Posted August 30, 2016 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 Quote Link to comment Share on other sites More sharing options...
symek Posted August 30, 2016 Share Posted August 30, 2016 If by intersection you mean finding the nearest spot on a prim from a point in question, you can use bellow combo: (u, v) = hou.Prim.nearestToPosition(pos3) (x, y, z) = hou.Prim.positionAtInterior(u, v, w=0.0) more: http://www.sidefx.com/docs/houdini15.5/hom/hou/Face Quote Link to comment Share on other sites More sharing options...
Daniel Posted August 30, 2016 Author Share Posted August 30, 2016 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 Quote Link to comment Share on other sites More sharing options...
symek Posted August 30, 2016 Share Posted August 30, 2016 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. 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.