nop head
2018-08-22 19:50:57 UTC
The ViewAll button has always produced a view that nowhere nears fill the
window. There was a discussion recently that pointed out a cube at the
origin comes out a different size if it is centred or not. An extreme case
is this:
translate([0, 10000, 0])
cube([100,100,100], center = true);
A 100 cube far from the origin comes out tiny. The culprit seem to be this
line
https://github.com/openscad/openscad/blob/0904a3b3a5b56b16bb423b177972468eeca775a9/src/Camera.cc#L75
I don't understand what (bbox.center()-this->center).norm() is trying to
do. It is this that makes the view change size depending on where it is and
removing it solves the problem. A 100 cube is a constant size regardless of
where it is. Here is the same cube.
So I can submit a PR unless somebody can explain why that expression is
needed.
In general it doesn't give the optimum zoom but it does fit the scene in
the window unless you make the window thinner than it is tall. It basically
ensures the bounding sphere of the object doesn't exceed the height of the
screen regardless of how the object is oriented. It should really look at
the bounding rectangle of the projected 2D image compared with the window
dimensions.
window. There was a discussion recently that pointed out a cube at the
origin comes out a different size if it is centred or not. An extreme case
is this:
translate([0, 10000, 0])
cube([100,100,100], center = true);
A 100 cube far from the origin comes out tiny. The culprit seem to be this
line
https://github.com/openscad/openscad/blob/0904a3b3a5b56b16bb423b177972468eeca775a9/src/Camera.cc#L75
I don't understand what (bbox.center()-this->center).norm() is trying to
do. It is this that makes the view change size depending on where it is and
removing it solves the problem. A 100 cube is a constant size regardless of
where it is. Here is the same cube.
So I can submit a PR unless somebody can explain why that expression is
needed.
In general it doesn't give the optimum zoom but it does fit the scene in
the window unless you make the window thinner than it is tall. It basically
ensures the bounding sphere of the object doesn't exceed the height of the
screen regardless of how the object is oriented. It should really look at
the bounding rectangle of the projected 2D image compared with the window
dimensions.