wolfhece.gpuview

Author: HECE - University of Liege, Pierre Archambeau Date: 2024

Copyright (c) 2024 University of Liege. All rights reserved.

This script and its content are protected by copyright law. Unauthorized copying or distribution of this file, via any medium, is strictly prohibited.

Module Contents

wolfhece.gpuview.msg = 'Error importing OpenGL library'[source]
wolfhece.gpuview._global_gpu_state[source]
wolfhece.gpuview.GRID_N = 100[source]
wolfhece.gpuview.VECFIELD_VTX_SHADER[source]
wolfhece.gpuview.VECFIELD_GEOM_SHADER[source]
wolfhece.gpuview.VECFIELD_FRAG_SHADER[source]
wolfhece.gpuview._load_shader(shader_type, source)[source]
wolfhece.gpuview._load_program(vertex_source, geometry_source, fragment_source)[source]
class wolfhece.gpuview.Rectangle(x, y=None, width=None, height=None)[source]
property xmin[source]
property xmax[source]
property ymin[source]

I use ymin to not use “bottom” because “bottom” depends on the y-coord orientation which can differ between screen coord or GL coord.

property ymax[source]
intersection(r)[source]
zoom(sx: float, sy: float)[source]
class wolfhece.gpuview.VectorField(x_extent, y_extent, bounds, dx, dy, idx: str = '', plotted: bool = True, mapviewer=None, need_for_wx: bool = False, minsize=0.1)[source]

Bases: wolfhece.drawing_obj.Element_To_Draw

Inheritance diagram of wolfhece.gpuview.VectorField

Draws a field of arrows.

The arrow are defined by an x and and y extent (in matrices) and drawn based on a grid (which we compute here).

zoom_2 = 2[source]

Logique de calcul: - on normalise les composantes vectorielles –> [0, 1] - on redistribue les normes entre [minsize , 1.] –> minsize==1 => toutes les flèches sont de taille identique - on recalcule les composantes vectorielles sur base de cette nouvelle norme - lors du dessin, on multiplie le facteur de mise à l’échelle par (self.zoom_factor * self.zoom_2)

  • le premier facteur tient compte de la mise à l’échelle globale du champ vectoriel sur base d’une combinaison de blocs –> Wolfresults_2D

  • le second facteur est purement graphique et sert à augmenter/réduire la taille tout en gardent la proportionnalité

update_zoom_factor(newfactor)[source]
update_zoom_2(newfactor)[source]
_set_data(x_extent, y_extent, max_norm=None)[source]
plot(sx=None, sy=None, xmin=None, ymin=None, xmax=None, ymax=None, size=None)[source]

Plot data in OpenGL context

_plot(projection_matrix)[source]
update_geometry(model_bounds: Rectangle, grid_bounds: Rectangle, nb_arrows_x: int, nb_arrows_y: int, arrow_scale_x: float, arrow_scale_y: float, aspect_ratio: float)[source]

Model bounds: the coordinates of the full model we draw (world coord) Grid bounds : the coordinates over which the grid will be computed (world coord); nb_arrows: number of vector to plot in x/y dimension expected to be a subset of model bounds. arrow_scale : scale factor for arrows (expected to be used to maintain the arrow size constant on screen) aspect_ration: to adapt to screen’s aspect ratio.