Center the camera on the LineMesh bounding box
AbandonedPublic

Authored by ervin on Aug 23 2018, 9:48 PM.

Details

Summary

Required adding a quick and dirty bounding box computation to the
LineMeshGeometry and expose it through LineMesh properties. Make sure
the camera is now looking at that point on file load and is positioned
relatively to it.

Diff Detail

Lint
Lint Skipped
Unit
Unit Tests Skipped
Build Status
Buildable 2258
Build 2276: arc lint + arc unit
ervin requested review of this revision.Aug 23 2018, 9:48 PM
ervin created this revision.
ervin set the repository for this revision to R231 Atelier.Aug 23 2018, 9:56 PM

This patch will not apply cleanly to master please check the base of this patch

patrickelectric accepted this revision.Aug 24 2018, 11:14 AM
patrickelectric added inline comments.
src/widgets/3dview/SceneEntity.qml
39

ha ! much better.

src/widgets/3dview/linemeshgeometry.cpp
44

We are fan of hugs ;) (one line brackets)
Please use our style script, under scripts/style.sh

This revision is now accepted and ready to land.Aug 24 2018, 11:14 AM

im not sure if its this patch of the one after but when you apply them all by D15045 the line mesh is not centered.

laysrodrigues accepted this revision.Aug 25 2018, 12:35 PM
rizzitello accepted this revision.Aug 25 2018, 4:01 PM
ervin added a comment.Aug 26 2018, 9:03 AM

im not sure if its this patch of the one after but when you apply them all by D15045 the line mesh is not centered.

Well, this one would potentially de-center the bed because it tries to center on the line mesh bounding cuboid, which is what Lays put in my list of todos. ;-)
Now obviously we can't have it centered on both at the same time.

ervin updated this revision to Diff 40455.Aug 26 2018, 9:04 AM

Applying the style script

rizzitello requested changes to this revision.Aug 26 2018, 10:56 AM

The grid is not centered in the view correctly anymore. It looks much worse then it did when it was centered..

This Diff.

Master.

This revision now requires changes to proceed.Aug 26 2018, 10:56 AM
ervin added a comment.Aug 26 2018, 4:24 PM

So this is due to the two points in the path which are way outside the mesh. With the data currently available I have no good way to distinguish them and so yes the bounding cuboid computation includes them. Now the thing is the bed display is wrong anyway, it's currently on fixed coordinates whatever real shape is had, clearly that doesn't help (I expect the model you use assumes a different bed).

So I see two ways out for that one, either:
a) we keep this one as is and see how it goes when we have proper bed metrics in the display, seeing what else needs to be adjusted, or
b) someone gives me a good heuristic for the cuboid computation or even better tries it by adjusting this patch locally ('cause I have in effect a single model to test with) and then we change the patch to use said heuristic (I suspect ignoring the first and last point would be enough, but clearly it's just gut feeling, I don't have enough domain knowledge).

ervin added a comment.Aug 26 2018, 4:30 PM

Ah yes, also third option:
c) drop that patch altogether, if there's no good way to have a heuristic to remove the points we don't want for the cuboid computation, despite Lays asking me to recenter the view by default, it's not set in stone and we could stay with the "center of the bed" version currently present

ervin added a comment.Aug 26 2018, 4:30 PM

So please advise. :-)

Hello ervin,
"-> Put camera view on the center of the object being rendered" <- yeah my bad --' (I think that I was following maybe the Cura guy advice about this...)
But I agree with @rizzitello , center on the bed is better than the model. because we can have more than one model on the bed, and that can make the centering a bit confusing.

Sorry about the mess!

rizzitello added a comment.EditedAug 26 2018, 5:08 PM

Thank your for explaining why the grid is not centered any longer.
We are not really loading a model but instead the path of the tool. Those two outer point are the first home for the tool and the finishing home written in the gcode. I've done some additional tests with this and confirmed that the gcode paths are being rendered correctly but our gcode layer.

You should be able to read the bed info from the current profile if connected however the 3d view is more a generic preview of the paths and does not require you to be connected to a printer at all. To complicate the issue a bit further there is only one 3d view no matter how many printers you connect so how does one decide what profile to preview with . What if we provided a few preview options to let the user change if the bed is round or square and its radius or x and y size (maybe the grid sizes too)? maybe have it just save that info to our config file so the users with only one printer only do it once. And it will default to reading from the first profile made.

ervin added a comment.Aug 27 2018, 6:02 AM

Sorry about the mess!

No worries! Sometimes, we need to try something to figure out it's not what we wanted. ;-)

I'll just drop that patch then.

ervin abandoned this revision.Aug 27 2018, 6:02 AM