20
edits
mNo edit summary |
mNo edit summary |
||
Line 66: | Line 66: | ||
== The role of "x_gl_mat2" == | == The role of "x_gl_mat2" == | ||
The matrix "x_gl_mat2" is composed of the sub matrices "x_viewport" and "x_projection". The purpose of these matrices is to fit the 2D image of the above transformation result into a "bounding box". The bounding box is defined as follows: | The matrix "x_gl_mat2" is composed of the sub matrices "x_viewport" and "x_projection". The purpose of these matrices is to fit the associated 2D image of the above transformation result into a "bounding box". The bounding box is defined as follows: | ||
bb(0), bb(1): Position of the | bb(0), bb(1): Position of the viewport | ||
bb(2), bb(3): Width and height of the | bb(2), bb(3): Width and height of the viewport | ||
Hint: If you debug in "update_camera ()", you can print "bb": | Hint: If you debug in "update_camera ()", you can print "bb": | ||
Line 80: | Line 80: | ||
get (hax, "position"); | get (hax, "position"); | ||
In the following simplified code section the matrix "x_projection" is assembled. It is used to | In the following simplified code section the matrix "x_projection" is assembled. It is used to normalize the image of the above transformation. For this purpose, the field of view (FOV) must be calculated: | ||
{{Code|Section of axes::properties::update_camera ()"|<syntaxhighlight lang="C" style="font-size:13px"> | {{Code|Section of axes::properties::update_camera ()"|<syntaxhighlight lang="C" style="font-size:13px"> | ||
Line 114: | Line 114: | ||
</syntaxhighlight>}} | </syntaxhighlight>}} | ||
"x_viewport" is a | "x_viewport" is a transformation used to place the "normalized" plot box in the center and to scale it into the bounding box: | ||
{{Code|Section of axes::properties::update_camera ()"|<syntaxhighlight lang="C" style="font-size:13px"> | {{Code|Section of axes::properties::update_camera ()"|<syntaxhighlight lang="C" style="font-size:13px"> | ||
Line 138: | Line 138: | ||
</syntaxhighlight>}} | </syntaxhighlight>}} | ||
Note: The matrix "x_gl_mat2" | Note: The matrix "x_gl_mat2" scales x, y so that the image fits tightly into the bounding box. The z-coordinate is not modified! |
edits