Hg200

Joined 29 March 2020
397 bytes added ,  2 January 2021
no edit summary
No edit summary
No edit summary
Line 11: Line 11:
== OpenGL coordinate systems ==
== OpenGL coordinate systems ==


[[File:Octave_coordinate_systems.png|center|750px]]
In the Octave plotting backend, we find various OpenGL transformations. Some of the classic OpenGL transformation steps, as well as coordinate systems, are shown in the following picture:
 
[[File:Octave_coordinate_systems.png|center|350px]]


== The role of "x_gl_mat1" ==
== The role of "x_gl_mat1" ==
Line 68: Line 70:
   bb(0), bb(1): Position of the "viewport"
   bb(0), bb(1): Position of the "viewport"
   bb(2), bb(3): Width and height of the "viewport"
   bb(2), bb(3): Width and height of the "viewport"
Hint: If you debug in "update_camera ()", you can print "bb": 
  (gdb) print *bb.rep.data@bb.rep.len
Compare the result with the output in the Octave prompt:
  hax = axes ();
  get (hax, "position");


In the following simplified code section, the field of view (FOV) is determined such that the image is fitted into the bounding box of the window:
In the following simplified code section, the field of view (FOV) is determined such that the image is fitted into the bounding box of the window:
Line 101: Line 112:
</syntaxhighlight>}}
</syntaxhighlight>}}


x_viewport is a 2D transformation used to place the "normalized" plot box in the center of the bounding box:
"x_viewport" is a 2D transformation used to place the "normalized" plot box in the center of 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">
20

edits