Delete points with opposite normals

   1800   2   1
User Avatar
Member
2 posts
Joined: Jan. 2021
Offline
Hi, I am a beginner in Houdini trying to make a house generator in Houdini Apprentice. Everything is working fine, but for the roof I need outer Corners and inner corners. The outer corners work fine, but on the inner corners I have issues with getting the points with the correct normals.
After getting all the inner points I first tried a fuse, but the normals I got out of that were completely wrong (Maybe I just don`t know how to work with this fuse node properly), so I tried something different. I created an attribute wrangle and put in this vex code.
float xPos = @P.x;  
float zPos = @P.z;
float xNorm = @N.x;
float zNorm = @N.z;
float comxPos;
float comzPos;
float comxNorm;
float comzNorm;
    for(int i=0; i < @numpt; i++){
        comxPos = vector(point(0,"P",i)).x; 
        comzPos = vector(point(0,"P",i)).z; 
        comxNorm = vector(point(0,"N",i)).x;
        comzNorm = vector(point(0,"N",i)).z;
        if(xPos == comxPos && zPos == comzPos){        
            if(xNorm + comxNorm + zNorm + comzNorm == 0){  
                setpointgroup(0,"OppositeNormals",@ptnum,1,"set");
            }
        }
    }
Then I use a blast to delete those points with opposite normals.
As you can see in the pictures, the code works for a few points, but not all and I don't know why. I would really appreciate if someone could help me.

Attachments:
Screenshot (2).png (397.1 KB)
Screenshot (4).png (429.8 KB)

User Avatar
Member
89 posts
Joined: Jan. 2015
Offline
Hello,
I suppose you first need to collect every point sharing the same position, and apply the test chunk by chunk.

Until someone can dig into your code (not my cup of tea), why don't use the fuse operator ? You can add an additional attribute to snap (N for instance), and use sum as output. Seems to work here :
Edited by PaQ WaK - Jan. 5, 2021 10:29:25

Attachments:
FUSEN.JPG (327.3 KB)

Gameloft
User Avatar
Member
2 posts
Joined: Jan. 2021
Offline
PaQ WaK
Hello,
I suppose you first need to collect every point sharing the same position, and apply the test chunk by chunk.

Until someone can dig into your code (not my cup of tea), why don't use the fuse operator ? You can add an additional attribute to snap (N for instance), and use sum as output. Seems to work here :

Thank you so much, man!!! Yeah, as I had said, I knew the fuse node, but since I am a beginner, who had no idea how the fuse node worked, I felt like I would do better with coding. But now I know, what I had to use in the fuse node and I'm happy! Thank you really much!
  • Quick Links