Behrendt Posted February 25, 2021 Share Posted February 25, 2021 Hi everyone, I posted some progress in another thread (Sidewalks - PathDeform? - Modeling - od|forum (odforce.net)). My VEX code for detecting intersecting geometry only seems to work on some parts of the model, whereas on others it does not seem to work at all. My idea for the code was to iterate over all points and fire a ray each up and down, to see if there is more than one intersection (it seems it generates always 1 intersection, for the self intersection), and if the point intersects with the geo, its added to a point group, so it can be fused at a later point. What could be the reason, that it only works on some parts of the model? vector RayDDown = {0,-100,0}; vector RayDUp= {0,100,0}; vector hitPos[]; int hitPrims[]; vector hitUVW[]; float tol = 0.00001; float ttol = 0.00001; int expand = 0; int stepping = 2; expand = expand * stepping; i@IntersectDown = intersect_all(0,@P, RayDDown, hitPos, hitPrims, hitUVW, tol, ttol); if (@IntersectDown > 1) { setpointgroup(0,"Intersecting", @ptnum-expand, 1, "set"); setpointgroup(0,"Intersecting", @ptnum, 1, "set"); setpointgroup(0,"Intersecting", @ptnum+expand, 1, "set"); } i@IntersectUp = intersect_all(0,@P, RayDUp, hitPos, hitPrims, hitUVW, tol, ttol); if (@IntersectUp >1) { setpointgroup(0,"Intersecting", @ptnum-expand, 1, "set"); setpointgroup(0,"Intersecting", @ptnum, 1, "set"); setpointgroup(0,"Intersecting", @ptnum+expand, 1, "set"); } I also included a screenshot illustrating the problem. Thanks in advance! Quote Link to comment Share on other sites More sharing options...
Aizatulin Posted February 26, 2021 Share Posted February 26, 2021 (edited) Hi, not sure what you are trying to achieve, but if you want to detect the points with intersection rays, which are in the overlapping area, you can duplicate the geometry, add an offset to y and move each points slightly based on their point number in y-direction. Now you should be able to send a ray from the original point to y-direction with little offset from the starting point. here is a file intersect_all_overlap.hipnc Edited February 26, 2021 by Aizatulin 1 Quote Link to comment Share on other sites More sharing options...
Behrendt Posted March 1, 2021 Author Share Posted March 1, 2021 Hi @Aizatulin, thanks for helping again - yes, my original idea was trying to use intersection rays to detect overlapping surfaces. As you can see it also worked fine one most meshes - on others it just wouldn't at all. I now found out about PolyDoctor (a lot of nodes to learn for a newcomer ) - which worked fine for detecting the overlaps. Still I'm interested to find out why my code only worked some of the time. As you proposed I also tried a Y-Offset to fix the problem, which didn't work out. Only thing that seemed to work was setting ttol to "-1" to get any interesections at all, otherwise the intersect didn't seem to hit anything. I guess it's a bias thingy and offsetting the points a little in X/Z would probably help, so the ray isn't hitting a point perfectly. Because when using ttol -1, the number of intersections per point grew, according to how many primitives it was connected to (which makes sense, but was unusable for my purposes). Maybe I will test further in a few days, but for now PolyDoctor worked fine. Thanks again Quote Link to comment Share on other sites More sharing options...
acey195 Posted March 2, 2021 Share Posted March 2, 2021 (edited) I think you just need to change the following : float tol = -1; float ttol = -1; then it should find all intersections, even the triangles are at exactly the same height Edited March 2, 2021 by acey195 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.