# Delete points with opposite normals

## Recommended Posts

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). As you can see it`s always 3 points at the same position with different normals while 2 of them are exactly opposite, 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 ==0 && zNorm + comzNorm == 0){
setpointgroup(0,"OppositeNormals",@ptnum,1,"set");
}
}
}```

Then I use a blast to delete all 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.

Edited by phinnonymous
##### Share on other sites

• 2 weeks later...

What might be going wrong is because normals and positions work with floats.
Which is a lot harder to compare to each other.

What you could do instead, is actually multiplying your vectors by 1000 or so and then use trunc() to remove the decimals.
This way the check will be a bit more stable. As floats can have many decimals.

##### Share on other sites

Is this the kind of results you're looking for?

I can't send files atm, but I commented as best as I could, it should be straightforward enough.

It gets you true bissextile angled Normals, non dependent of each point segments length, hence no resample node needed, like I so often see on this kind work. The curvature node gets you an easy mean to set up your inner and outer corners. could even take it a step further, and identify with are straight angled or not, too; just look at the values you get in the spreadsheet. The 'trick' is to not use the fuse node with it's defaults setting, but I commented all that you need to change.

I guess I could also have added a polypath at the end, reunify the primitive segments back into only one.

And of course it could be even more set up with vex.

##### Share on other sites

I just realized, you probably want inverted @N form what I've shown.

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

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×