Editing User:Hg200
Jump to navigation
Jump to search
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 1: | Line 1: | ||
= | = Investigations on update_camera() = | ||
In the | In the second part of <math display="inline">\rightarrow</math> axes::properties::update_camera () the view transformation "x_gl_mat1" and projection matrix "x_gl_mat2" are put together. The following images illustrate some of the properties of "x_gl_mat1". | ||
== The Octave coordinate system == | |||
= The Octave coordinate system = | |||
In Octave a plot scene is defined by a "view point", a "camera target" and an "up vector". | In Octave a plot scene is defined by a "view point", a "camera target" and an "up vector". | ||
[[File:Octave_view_point_setup_to_scale.png|center|750px]] | [[File:Octave_view_point_setup_to_scale.png|center|750px]] | ||
== The role of "x_gl_mat1" == | == The role of "x_gl_mat1" == | ||
The following section of code | The following section of code assembles the matrix "x_view", which is a subset of "x_gl_mat1". The matrix "x_gl_mat1" consists of different translations, scalings and a rotation operation. | ||
{{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"> | ||
// Unit length | // Unit length vectors for direction of view "f" and up vector "UP" | ||
ColumnVector F (c_center), f (F), UP (c_upv); | ColumnVector F (c_center), f (F), UP (c_upv); | ||
normalize (f); | normalize (f); | ||
normalize (UP); | normalize (UP); | ||
// Calculate the vector rejection UP onto f | // Calculate the vector rejection UP onto f | ||
Line 57: | Line 43: | ||
</syntaxhighlight>}} | </syntaxhighlight>}} | ||
To visualize the matrix properties, the "x_gl_mat1" matrix is multiplied by the object coordinates. The plot box is now aligned with the Z-axis and the view point is at the origin <math display="inline">[0,0,0]</math>. The matrix transforms world coordinates into camera coordinates. The purple planes show the near and far clipping planes. | |||
[[File:Octave_x_gl_mat1_setup.png|center|250px]] | |||
[[File:Octave_x_gl_mat1_setup.png|center| | |||
The individual translation, scaling and rotation operations of "x_gl_mat1", are shown in the following figure: | The individual translation, scaling and rotation operations of "x_gl_mat1", are shown in the following figure: | ||
[[File:Octave_x_gl_mat1_steps.png|center|1100px]] | [[File:Octave_x_gl_mat1_steps.png|center|1100px]] | ||