IGLTriad
Module: graphics
Renderable coordinate triad for OpenGL visualization.
The triad consists of axis-aligned cylinders and cones representing the X,
Y, and Z axes. It supports rendering into a small overlay viewport and
optionally drawing axis labels with a Qt QPainter.
__init__
method
__init__(self, size: float)
Initialize the triad, including its geometry and render state.
Args
| Name | Type | Description |
|---|---|---|
| size | Uniform scale factor applied to the axis geometry. |
SetShader
method
SetShader(self, shader: Any)
Set the shader program used to render the triad geometry.
Args
| Name | Type | Description |
|---|---|---|
| shader | Shader object providing use(), set_mat4(), and set_vec3(). |
_create_vao
method
_create_vao(self, data: NDArray[np.float32])
initialize
method
initialize(self)
Create OpenGL vertex array objects for the axis meshes.
The method creates VAOs and VBOs for the cylinder and cone mesh data if
they have not already been initialized.
SetQPainter
method
SetQPainter(self, painter: QPainter)
Assign the QPainter used to draw overlay axis labels.
Args
| Name | Type | Description |
|---|---|---|
| painter | QPainter configured for the current Qt paint cycle. |
_axis_matrix
method
_axis_matrix(self, axis: str)
draw
method
draw(self, camera: Any, width: int, height: int)
Render the triad in a fixed-size overlay viewport.
The triad is rendered using an orthographic projection and a camera view
matrix with the translation component removed so that the axes remain
stable as an overlay.
The triad is rendered using an orthographic projection and a camera view
matrix with the translation component removed so that the axes remain
stable as an overlay.
Args
| Name | Type | Description |
|---|---|---|
| camera | Camera object exposing view_matrix() returning a QMatrix4x4. | |
| width | Full widget width in pixels. | |
| height | Full widget height in pixels. |
draw_triad_labels
method
draw_triad_labels(self, base: QMatrix4x4, width: int, height: int)
Draw labeled axis annotations for the triad overlay.
The label positions are computed from the post-projection clip-space
coordinates of the axis cone tips and converted into viewport pixel
coordinates.
The label positions are computed from the post-projection clip-space
coordinates of the axis cone tips and converted into viewport pixel
coordinates.
Args
| Name | Type | Description |
|---|---|---|
| base | Combined projection/view matrix for the overlay render. | |
| width | Width of the overlay viewport in pixels. | |
| height | Height of the overlay viewport in pixels. |
drawOrigin
method
drawOrigin(self, camera: Any)
Render the triad using the main camera projection matrix.
This method draws the origin indicator in the main scene coordinate
system rather than in an overlay viewport.
This method draws the origin indicator in the main scene coordinate
system rather than in an overlay viewport.
Args
| Name | Type | Description |
|---|---|---|
| camera | Camera object exposing projection_matrix() and view_matrix(). |