Netherlands
Joined: Apr 8, 2022
Post Count: 1442
Status:
Offline
Re: Pan tool in 3D and 2D view?
Just found out that the 'bug' I mentioned is the same when you use the deformation dialog in Sweet Home 3D. I don't use that dialog very much because it's much easier to check if the deformations work as intended in the 3Dview. Conclusion: it's definitely NOT a Pan3Dview problem but simply the way Sweet Home 3D works. It's not convenient but in an awkward way logical.
---------------------------------------- Dodecagon.nl 1300+ 3D models, manuals, and projects
Netherlands
Joined: Apr 8, 2022
Post Count: 1442
Status:
Offline
Bug in Pan3Dview plugin with chained deformation
Found a bug in the experimental deformation in 3dview in Pan3DView. This is with a chained deformation.
Door on hinge1. A handle on the door that turns on hinge2. hinge2 and the handle turn on hinge1.
In the 3Dview opening the door works as expected: the door opens and the handle goes along. No problem. In the start position the handle also turns as expected. No problem.
But now you turn the door halfway open and then turn the handle: it seems the handle uses hinge2 in the original start position, i.e. the handle now turns diagonally. Hinge2 was moved along with the door and the handle and that position should be used for turning the handle.
In the Sweet Home 3D Modify openings dialog this problem does NOT occur and works as expected. This dialog can't be rezized and you can't zoom in very far so for most furniture I create it's useless. You can hardly see a toilet lock on a toiletdoor so you can't see it turning in this dialog. That's why I heavily depend on the deformations in the 3Dview.
---------------------------------------- Dodecagon.nl 1300+ 3D models, manuals, and projects
Italy
Joined: Nov 17, 2021
Post Count: 474
Status:
Offline
Re: Bug in Pan3Dview plugin with chained deformation
Hi Keet, thank you for having reported the bug and for the test file. Sadly I haven't found a solution yet. I guess that I have to find a way to consolidate the deformation when the user releases the mouse, so that the hinges are updated. Any hint is welcome.
Netherlands
Joined: Apr 8, 2022
Post Count: 1442
Status:
Offline
Re: Bug in Pan3Dview plugin with chained deformation
I haven't got a development environment yet for Java so it's very hard to look at code. My first step would be to compare the plugin code to the code behind the Sweet Home 3D modify openings dialog. There the deformations work as they should. Thinking from the top of my head I suspect the calculations for the deformations follow the chain af deformations, probably in an array loop where the start position and direction is recalculated for every step. It's possible that you only use the initial position and direction and don't follow the chain to get a new start position from the previous deformation in the chain. Usually a direction is a set of X,Y,Z coordinates like they are used for textures but I don't know if that's the same for the deformations.
---------------------------------------- Dodecagon.nl 1300+ 3D models, manuals, and projects
Netherlands
Joined: Apr 8, 2022
Post Count: 1442
Status:
Offline
Re: Bug in Pan3Dview plugin with chained deformation
This is related to the last bug I reported and possibly determines the cause of the wrong deformation:
I have a garage door that opens on a hinge some distance from the door to simulate rotating from bottom to top like a real garage door. Again the deformation in the Sweet Home 3D dialog is correct. Placed in a horizontal drawn wall the deformation in the 3Dview is correct but when I have a diagonally drawn wall the same garage door incorrectly deforms diagonally. The initial diagonal position is apparently the cause and the same as what happend with the wrong deformation in the previouly reported bug.
I tried the same with the Scopia turn window. The result is the same (even without a wall): horizontal placed deforms correct, rotated diagonal deforms diagonally. SO it's definitely not caused by the door object itself.
I investigated further with the test example I previously provided. I rotated the test object diagonally and expected the deformation of the door (hinge_1) to go wrong. Surprisingly that still went correct, even when I rotated the object diagonally or on its side! The second deformation remained wrong. So I added a third hinge to the test object, opening on hinge_2. The result was that that both hinge_2 and hinge_3 went wrong but hinge_1 remained correct. Hinge_3 did deform correct when hinge_2 was not deformed but that might have been because both hinge 1 and 2 are vertical hinges.
I hope this helps to determine the problem. No hurry to fix it. I can see that a deformation works for a new object and that's the most important for now.
---------------------------------------- Dodecagon.nl 1300+ 3D models, manuals, and projects
Italy
Joined: Nov 17, 2021
Post Count: 474
Status:
Offline
Re: Bug in Pan3Dview plugin with chained deformation
The code used by the plugin actually comes from the edit deformation dialog (it's almost a copy-paste), so I can't just look at SH3D code to see how to do it. The problem should be in the way various components interact each other, but understanding it is time consuming because SH3D is heavily based on interfaces, so I have to search implementations by hand. I will try to find it out, but this isn't on top of my roadmap.
About the problem of rotation, I remember I've read that the rotation axe is computed based on the highest dimension of the hinge node, so maybe you have to resize it properly.
Netherlands
Joined: Apr 8, 2022
Post Count: 1442
Status:
Offline
Re: Bug in Pan3Dview plugin with chained deformation
Yes, the rotation axe is computed on the highest dimension but in other words that means it looks for the longest distance between two points to use as the direction. For hinges the position is also important since the rotation should use it as the center point for rotating. Rails don't have that problem, they can be far away from the parts that use the rail and the rail just prescribes the path for sliding. A ball has a similar situation as the hinge but the only important data point is the center for rotating around the point.
The main point is that when a hinge rotates it changes the direction for other hinges connected to it. Besides that, my test with the Scopia turn window proved that a start position of the furniture in a diagonal position is already enough to cause the deformation to go wrong. That one I can't explain because it shouldn't be a problem with just a single hinge.
The Sweet Home 3D dialog doesn't have this problem because it simply takes the object and displays it in the preview in it's default (horizontal) position. Your deformation in the 3Dview is much more difficult because you have to determine the changed angles of the hinges. On the other hand, in that dialog the code must recalculate for chained deformations using the hinge one up in the chain as the start point.
When you get to looking into this, try and log the original hinge directions and the directions as calculated from the 3Dview. Maybe that helps in finding the place to recalculate. It's a difficult problem which might have either a very difficult solution or an amazingly simple one.
As I said, no hurry to fix this. There are more important things that come first.
---------------------------------------- Dodecagon.nl 1300+ 3D models, manuals, and projects