MAYA_ Posted January 16, 2018 Share Posted January 16, 2018 I have two points and I am trying to figure out if there is a primitive "between" them (just if a straight line from A to B will intersect with it) but I am slightly stuck. I attempted this by calculating the distance between them and the distance along vector AB to the intersection and comparing the two values. But I can't seem to calculate the second. I have been using xyzdist() but I am not sure about how to approach the "along the vector" side of this as (as far as I understood it), xyzdist() just gives me the closest intersection without regarding a direction vector? Is there any function I could use for this? I would appreciate any help Thank you! Quote Link to comment Share on other sites More sharing options...
Noobini Posted January 16, 2018 Share Posted January 16, 2018 you should be able to repro this easily..I just whacked the nodes in no mods necessary....(except for the non-straight line) Quote Link to comment Share on other sites More sharing options...
MAYA_ Posted January 16, 2018 Author Share Posted January 16, 2018 7 hours ago, Noobini said: you should be able to repro this easily..I just whacked the nodes in no mods necessary....(except for the non-straight line) Hello Thank you very much! That is cool but I need to figure out how to do this in VEX as well as I need it further down the line in my code. Would you know how to approach this? Quote Link to comment Share on other sites More sharing options...
MAYA_ Posted January 16, 2018 Author Share Posted January 16, 2018 Oh wait, my brain just didn't function for a second there. I realised I could just use intersect() to get the point.. Sorry about this Quote Link to comment Share on other sites More sharing options...
Maurits Posted January 16, 2018 Share Posted January 16, 2018 Hey I think the intersect_all function in Vex is what you are looking for. http://www.sidefx.com/docs/houdini/vex/functions/intersect_all.html Quote Link to comment Share on other sites More sharing options...
MAYA_ Posted January 16, 2018 Author Share Posted January 16, 2018 (edited) 2 hours ago, Maurits said: Hey I think the intersect_all function in Vex is what you are looking for. http://www.sidefx.com/docs/houdini/vex/functions/intersect_all.html Yeah, I used intersect() and it works fine but, I assumed that &p: int intersect(<geometry>geometry, vector orig, vector dir, vector &p, float &u, float &v) would write out the point of intersection between the ray and geometry. For me, it just copies @P (orig vector) giving me the points position as the intersection point which clearly doesn't make sense. Did I understand it wrong? edit: I changed the orig vector to something else and &p gives me the orig vector every time? The dir vector is (goal - orig) Edited January 16, 2018 by SquirkyTurtle Quote Link to comment Share on other sites More sharing options...
MAYA_ Posted January 16, 2018 Author Share Posted January 16, 2018 21 minutes ago, SquirkyTurtle said: Yeah, I used intersect() and it works fine but, I assumed that &p: int intersect(<geometry>geometry, vector orig, vector dir, vector &p, float &u, float &v) would write out the point of intersection between the ray and geometry. For me, it just copies @P (orig vector) giving me the points position as the intersection point which clearly doesn't make sense. Did I understand it wrong? edit: I changed the orig vector to something else and &p gives me the orig vector every time? The dir vector is (goal - orig) Okay, I figured it out. It was because for some calculations the point was past the point of the dir vector, so it just returned 0 because I assume it wasn't 'long' enough. I multiplied it by 10 and it works fine now Quote Link to comment Share on other sites More sharing options...
Noobini Posted January 16, 2018 Share Posted January 16, 2018 5 hours ago, SquirkyTurtle said: Hello Thank you very much! That is cool but I need to figure out how to do this in VEX as well as I need it further down the line in my code. Would you know how to approach this? yeah sorry it wasn't a direct answer coz I'm not a VEX expert myself...but I was hoping that would provide you with a spark with the thought process, it did !!! 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.