[Contents] [TitleIndex] [WordIndex

subwinDrawing package

Box Drawing

The drawing of the box is based on the concealed corner which is the farthest corner form the view point. From this point is computed the position of the back thriedron is drawn (the part drawn with dashes) and then the whole box.

The box is composed of 8 points stored in the SubwinBoxDrawer class. Once the index of the concealed corner has been found within the 8 corners, the lines and facets composing the box are found in the BACK_TRIHEDRON, BACK_FACETS, HALF_BOX_LINES and FRONT_TRIHEDRON arrays.

For example if the concealed corner index is 1, the lines composing the back trihedron are between point 1 and point 0, between point 1 and point 3 and between point 1 and point 5.

There are 4 final implementations of the SubwinBoxDrawerGL class depending on the part of the box to draw.


The idea of the camera is to be able to avoid always converting 3D coordinates into pixel ones each time a vertex needs to be rendered as in Scilab 4. There is no camera in OpenGL, the idea is just to move the viewpoint from the scene (in OpenGL it's only possible to move the scene from the viewpoint, but finally it is the same).

This part is quite tricky and could probably be refactored. Here are some explanation on how the camera is set:

For more informations about the camera see: Specificities for each handles

The major difference between the two kinds of camera are the setting of viewport in glOrtho. In isoviewMode, both width and height must match the real viewPot size while in normal mode the two must be equal in order to follow width and heigth modifications.

The last mode cube scaling is actually done by modifying the axes box scaling parameters.

Note that in Scilab 5 we use only othographic projection (with glOrtho), but it could be nice to add perspective for better realism.

Ticks Drawing

Ticks drawing is made by the TicksDrawerGL class and is used both for the subwin object and the axis one. Each instance of a TicksDrawerGL is reponsible for drawing the ticks of one axis (so there is 1 in each axis object and 3 in a subwin object). The entry points for ticks drawing are the drawTicks methods, one drawing ticks and labels the other adding exponents to labels. The ticks drawing is composed of several steps:

The difference of the draw and show methods in the class is that draw is precomputing some data (such as bounding boxes, labels positions, ...) which won't be recomputed in the show method.

2022-09-08 09:27