Furniture to Solid

This topic has been viewed 271492 times and has 11 replies
Thread status: Active
Questions about extending features and developing plug-ins [img]http://www.sweethome3d.com/images/flags/en_small.gif[/img]
User avatar
Daniels118
Posts: 503
Joined: Wed Nov 17, 2021 9:04 pm
Country: Italy

Re: Furniture to Solid

Post by Daniels118 »

The "center" is a relative concept. SH3D calculates the center of a furniture as follows:
it iterates over all vertices and creates a bounding box; then it uses the midpoint of XZ boundaries along with the lowest Y. This value is then negated and used as a translation offset in the transform matrix. No value is modified in the vertex array.
When you move the furniture in the plan, an additional transform matrix is applied based on position, rotation and scale of the furniture in plan (the values which you see in the furniture properties window). Again, no value is modified in the vertex array; this happens in the rendering pipeline at each frame rendering.
When you export the selection to OBJ, a new vertex array is built with all transforms applied. I don't remember if a further step is made to center the resulting model within the boundaries, but if you need it you can do it yourself as described before: iterate to build the bounding box, calculate the center offset, the iterate again to apply the offset.
User avatar
dorin
Posts: 824
Joined: Thu Apr 24, 2014 9:14 am
Country: Vatra Dornei, Suceava, Romania

Re: Furniture to Solid

Post by dorin »

Somehow, I managed to solve this part.
Of course, 99 new problems arose.
I have all the time in the world to solve them.
A computer program does what you tell it to do, not what you want it to do. Murphy's Law
When all else fails, read the instructions. Murphy's Law
If you don't like "AS IS", DIY. Dorin's law
Post Reply New Topic

Who is online

Users browsing this forum: No registered users and 1 guest