# Orient object procedurally (make it stand) based on its longest side

## Recommended Posts

I have attached a bgeo file.

I have an object that needs to be oriented (procedurally) depending on its longest side, from which ever random orientation it has to standing straight in the Y axis with the longest side (see images from to).

Any idea?

orient_standing.bgeo

##### Share on other sites

You could apply the transformation matrix of the oriented bounding box.

Edited by konstantin magnus
##### Share on other sites

Im afraid, the sidefx orient bounding box is easy to fail, just a simple transform and it doesn't line the obj properly in Y

I would useg eigen vectors for this .

A more simple way will be to use labs did straighten sop were you have to select groups for orientation. or maybe you could measure the longest edge and use the rotation different with the Y axis to align with some matrix maths?

##### Share on other sites

Longest edge would work for this piece. @vinyvince Do you have an example file using eigenvectors?

rotate_to_longest_edge.hiplc

##### Share on other sites

You such a gentleman @konstantin magnus, and i learn so much from you  off course!

i can't refuse you anything, excepted maybe to kiss my girlfriend

i will send you one personal tool i have done

##### Share on other sites

There are many ways to do this sort of thing, but one thing I would recommend is using the convex hull geo to compute it for speed. In this case it already looks convex but I am talking in an HDA sense.

Also there are many assumptions and shortcuts one can take. For example to compute an MVB (Minimum Volume Box), at least of the faces in the convex hull will touch one of the faces on its MVB. Then there is brute force methods searching on all faces, vs other clever ways but sometimes brute force is actually faster.

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

×
×