galagast
08-05-2009, 02:17 PM
Hi, is there a way to save the true TM of an orthographic view? (LEFT, FRONT, TOP etc..)
Whenever I run the viewport.getTM(), I get values like these:
(matrix3 [1,0,0] [0,0,-1] [0,1,0] [-115.022,-16.7307,0])
(matrix3 [1,0,0] [0,0,-1] [0,1,0] [1.17456,-2.20587,0])
(matrix3 [1,0,0] [0,0,-1] [0,1,0] [158.041,128.517,0])
where it doesn't seem to get any scale/zoom values.
I'm able to make use of the row4 position though, it's just the zoom factor that's missing.
The closest thing that I have right now is by using the viewport.ZoomToBounds function. But in order to use this properly, I need to supply the correct pointA and pointB arguments that it needs...
I tested the function using this:
viewport.ZoomToBounds false [-1, -1, -1] [1, 1, 1]
which works well, then I tried to get the screen scale factor:
getScreenScaleFactor [0,0,0]
it returned this number:
2.34651
Does anyone have any clue how the number was derived? I just wanted to have a clearer undertanding where this number came from.
I will be using the number to generate the required point3 data by the ZoomToBounds function. Here is the working function that I'm using:
fn getOrthoZoomBounds =
(
if not viewport.IsPerspView() do
(
theMagicNumber = 2.34651
viewFactor = ( getScreenScaleFactor [0,0,0] ) / theMagicNumber
theScale = [viewFactor, viewFactor, viewFactor]
viewOffset = -(inverse (getViewTM())).row4
pointA = -theScale - viewOffset
pointB = theScale - viewOffset
#(pointA, pointB)
)
)
Thanks in advance for any insights. :D
Whenever I run the viewport.getTM(), I get values like these:
(matrix3 [1,0,0] [0,0,-1] [0,1,0] [-115.022,-16.7307,0])
(matrix3 [1,0,0] [0,0,-1] [0,1,0] [1.17456,-2.20587,0])
(matrix3 [1,0,0] [0,0,-1] [0,1,0] [158.041,128.517,0])
where it doesn't seem to get any scale/zoom values.
I'm able to make use of the row4 position though, it's just the zoom factor that's missing.
The closest thing that I have right now is by using the viewport.ZoomToBounds function. But in order to use this properly, I need to supply the correct pointA and pointB arguments that it needs...
I tested the function using this:
viewport.ZoomToBounds false [-1, -1, -1] [1, 1, 1]
which works well, then I tried to get the screen scale factor:
getScreenScaleFactor [0,0,0]
it returned this number:
2.34651
Does anyone have any clue how the number was derived? I just wanted to have a clearer undertanding where this number came from.
I will be using the number to generate the required point3 data by the ZoomToBounds function. Here is the working function that I'm using:
fn getOrthoZoomBounds =
(
if not viewport.IsPerspView() do
(
theMagicNumber = 2.34651
viewFactor = ( getScreenScaleFactor [0,0,0] ) / theMagicNumber
theScale = [viewFactor, viewFactor, viewFactor]
viewOffset = -(inverse (getViewTM())).row4
pointA = -theScale - viewOffset
pointB = theScale - viewOffset
#(pointA, pointB)
)
)
Thanks in advance for any insights. :D
