Jump to content

Rotate to have the largest face/primitive down

Recommended Posts

I'm running a for-each-connected loop, and need to rotate separate shape such that the largest face is down, for example the one marked L is the largest for the shape in the image.

I have a theoretical idea, no clue how to implement it, and not sure if there is a faster or simpler way:

(1) get the largest face (no idea how)

(2) rotate till the normal of the largest face is facing down

Again it's too theoretical, but if you have a way that would turn these flat on they largest face I'll be grateful


largest face down.JPG

Share this post

Link to post
Share on other sites

This isn't too bad. What you want to do is, for each piece:

  1. measure the area of all primitives
  2. find the largest primitive (sort by area)
  3. compute the primitive normal
  4. use dihedral() to compute the matrix that rotates that primitive normal to face {0,-1,0}
  5. multiply all points in the piece by that matrix

I'm attaching an example file.


  • Like 1

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now