Jump to content

Flatten polygon selection based on normals


Go to solution Solved by zipit,

Recommended Posts

Hi @bjlotus,

 

6 hours ago, bjlotus said:

I'm calculating the mean (i think) using the "normals_avg"  variable. I add each cross product inside the for loop and then divide by the amount of polys selected. This was a quick example so I just calculated normals the way I remembered when I used to play with other software years ago. I'm not even checking if the polys are a triangle hehe... your GetPolygonNormal function is certainly more elegant. I compared the results and, while not always exactly the same, they are pretty close.

 

This was not me be pedantic about terminology and you are computing the mean and the normals. I was just pointing out that you were just computing the normal for one of the planes in a polygon - unless I am overlooking something here. But for quads there are two, one for each triangle in the quad. Below is an illustration of a quad which I did manually triangulate for illustration purposes. You can see the vertex normals in white (which are each equal to the normal of the triangle/plane the lie in). And two plane normals in black, one for each triangle. The actual polygon normal is then the arithmetic mean of both plane normals.

 

image.thumb.png.d0241603f21b37fd7f8ebbdaa1bac6f5.png

 

So when you just pick one vertex in a quad to calculate the polygon normal, i.e., simply say one of the white normals is the polygon normal, then you assume that both tris of the quad lie in the same plane, i.e., that the quad is coplanar. Which of course can happen, but there is no guarantee. Quads are today usually quite close to being coplanar (and not that comically deformed as my example), but you will still introduce a little bit of imprecision by assuming all quads to be coplanar. 

 

Cheers,

Ferdinand

Link to post
  • Replies 11
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

Hi @bjlotus, hi @Cairyn,   there is one problem with your normals calculation. You calculate just a vertex normal in the polygon and then declare it to be the polygon normal 😉 (your variable

Hi @bjlotus,     This was not me be pedantic about terminology and you are computing the mean and the normals. I was just pointing out that you were just computing the normal for one

If you want to flatten a group of polys, you need to define the plane you are flattening them against. That is pretty arbitrary; you could use a plane perpendicular to the average of all normals, or m

Posted Images

17 hours ago, zipit said:

Hi @bjlotus,

 

 

This was not me be pedantic about terminology and you are computing the mean and the normals. I was just pointing out that you were just computing the normal for one of the planes in a polygon - unless I am overlooking something here. But for quads there are two, one for each triangle in the quad. Below is an illustration of a quad which I did manually triangulate for illustration purposes. You can see the vertex normals in white (which are each equal to the normal of the triangle/plane the lie in). And two plane normals in black, one for each triangle. The actual polygon normal is then the arithmetic mean of both plane normals.

 

image.thumb.png.d0241603f21b37fd7f8ebbdaa1bac6f5.png

 

So when you just pick one vertex in a quad to calculate the polygon normal, i.e., simply say one of the white normals is the polygon normal, then you assume that both tris of the quad lie in the same plane, i.e., that the quad is coplanar. Which of course can happen, but there is no guarantee. Quads are today usually very close to being coplanar (and not that comically deformed as my example), but you will still introduce a little bit of imprecision by assuming all quads to be coplanar. 

 

Cheers,

Ferdinand

 

Hi @zipit!

oh, now I totally understand what you mean! (pun intended 😄)

Thanks so much for the clarification; that would explain the tiny differences when I compared the results using your function. 

 

PS: it didn't sound pedantic at all!

 

Best,

Jon

 

Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

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

ABOUT US

We are Cinema 4D Community of dedicated, friendly and passionate artists, hobbyists and developers. Feel free to join us to share your knowledge, your art and anything that might help Community to grow and become a better place for everyone. We are providing guidance, free plugins and files, feedback and various discounts for our Contributors and much more. :cowboypistol:

SUPPORT

Tickets

Purchases

×
×
  • Create New...

Copyright Core 4D © 2021 Powered by Invision Community