Netherlands
Joined: Apr 8, 2022
Post Count: 1412
Status:
Offline
Deformation bug (update)
I created a flood light but there seems to be a bug with the deformation when the model is exported and imported with a changed form.
#1 is the original, complete, and functional model. Green indicates where hinge1 is and red is hinge2 which opens on hinge2. A normal and correct deformation chain.
After changing the deformations in the Modify openings dialog it looks like #2. As you can see the rotation on hinge1 is correct and the following rotation on hinge2 is also correct. So far so good.
But now I export #2 and import it again. After import it looks just the same as #2 but when I try to adjust the deformations the pivot on hinge 2 is incorrect as shown in #3. I know that such an incorrect deformation can occur when you change deformations in the 3D view (Pan3Dview feature) but that should NOT happen using the Modify openings dialog.
I did some testing where I made hinge2 visible to see what happens. After import of the deformed model (#2) everything moves correctly on hinge1. But the lights that move on hinge2 use a wrong pivot line, i.e. not where hinge2 is located. I think the horizontal position from the initial model (#1) is used as it seems that the lights rotate around that line. I have seen this problem before when exporting/importing a model that is rotated or tilted. The pivot line is recalculated and it changes direction. But in this case that should be virtually impossible. Hinge2 is where the red line shows just thinner and a little shorter so the ends are inside the bolts. That is the top face of a box 26cm wide and 0.1cm deep. It doesn't seem possible that the direction is calculated as anything other than between the two ends.
This looks like a bug in the calculation of the pivot lines. I think that the pivot line is not recalculated according to the new position of the hinges. No problem for hinge1 since that one doesn't change position but it is a problem with hinge2.
ETA Extra test I prepared a special hinge2: only two vertices (points) and a line (l) between them. In other words, a single edge, no face. Fortunately you can still add a material to an edge which allows you to make the hinge invsible. (A 'l' line in an object file is a line that connects two previously defined vertices 'v') Sweet Home 3D accepts this single line as a valid object part and you can prefix the deformation string. Works perfectly fine until... the same problem remains although there is absolutely NO doubt that hinge2 is a single line that defines the deformation pivot line. Ergo, when you import you import #2 the 'new' vertice points are not recalculated to the new pivot line.
Although the test failed (or rather confirmed the problem) there's still a small success: In my quest to optimize objects to the max I will from now on use a single line object for hinges. After all this
v 286.14502 0.5005 112.329605 v 312.14502 0.5005 112.329605 l 1 2
is less than this
v -134.5 78.5 -0.5 v -134.5 78.5 0.5 v 134.5 78.5 0.5 v 134.5 78.5 -0.5 vt 0.0 1.0 0 vt 0.0 0.0 0 vt 1.0 0.0 0 vt 1.0 1.0 0 vn 0.0 1.0 0.0 f 1/1/1 2/2/1 3/3/1 f 1/1/1 3/3/1 4/4/1
And of course you can place such a hinge exactly where it needs to be
ETA 2 I did some more testing because this is a bad one. - I created a simple model with boxes roughly in the same shapes as the flood light. The results are the same. - I removed the Pan3Dview plugin because the experimental feature of this plugin shows the exact same problem in the 3Dview. The problem persists in the Sweet Home 3D Modify openings dialog. - Tried with version 7.3 of Sweet Home 3D. The problem remains the same. - The problem is even worse than I thought: In my doors library I have a toilet door that opens and it has a toilet lock that you can turn. I am greatly disappointed that this model also shows the same problem. And that is without exporting a deformed model and importing again, just the straith model without initial deformations.
I could determine some other facts: Open the door halfway and turning the lock is wrong. The lock turns out of place, similar to the flood light. But if you first turn the lock and then open the door the deformation is correct. Exporting a deformed model and importing stays the same: the part on the second hinge (the lock) deforms incorrect by default.
I think I can define the cause of the problem: with every deformation action the hinges must be recalculated so the attached parts deform along the correct path. That only seems to happen for the attached parts as long as you deform in the reverse order of the deformation chain. What should happen is that ALL the hinge paths further in the chain must be recalculated when a part of the model is deformed. I stated that wrong, it are the parts connected to a hinge that seem to use the previous position of the hinge, not the new position after a deformation change. That is why a rotation on hinge1 remains correct: the hinge doesn't change position. But hinge2 changes position (correctly) but NOT the parts attached to hinge2. They seem to rotate on the previous position of hinge2. This will cause more calculations but it is necessary to get the correct deformations in any position.
I removed the '?' from the title because this is definitely a bug.
(Sourceforge bug report ticket #1329)
---------------------------------------- Dodecagon.nl 1000+ 3D models, manuals, and projects
----------------------------------------
[Edit 5 times,
last edit by Keet at Jun 8, 2025, 8:01:03 PM]