Skip to content

figure_view3d ​

figure_view3d, a 3-D view of meshes (view3d_object), drawn by FIGURE's software rasterizer in every mode.

A view holds meshes (triangles, quads, structured surfaces, lines), each optionally coloured by a scalar per vertex or per cell through a colormap (ip_colormap's names), a camera (orbit, pan, zoom, fit, six standard views) and clipping planes; v%draw(id, width, height) draws it as a widget inside any window. The image is rendered on the CPU (native/figure_view3d.cpp) into a texture, so window, remote and headless modes show the same pixels; it is rendered again only when something changed.

fortran
 type(view3d_object)       :: v
 real(real64), target      :: xyz(3, 40, 20), p(40, 20)
 integer(int32)            :: wing
 call v%init()
 wing = v%surface(xyz, scalar=p, colormap='cool-warm')   ! the arrays are read in place, at every render
 ... every frame, inside a window:
 call v%draw('view', 0.0_real64, 0.0_real64)               ! the available region
 if (v%clicked(mesh, element)) ...                        ! the element clicked

Data in place. The view keeps the addresses of the program's arrays (coordinates, connectivity, scalars): they must have the target (or pointer) attribute, be contiguous, and stay allocated while the mesh exists. After changing their values, call v%changed(mesh): the normals, the scalar's range and the connectivity's checks are derived again and the view is rendered at the next draw.

Source: src/lib/figure_view3d.F90

Dependencies

Contents ​

Variables ​

NameTypeAttributesDescription
K_TRIANGLESinteger(kind=c_int)parameterMesh kinds of the native layer.
K_QUADSinteger(kind=c_int)parameterQuads.
K_SURFACEinteger(kind=c_int)parameterStructured surface.
K_LINESinteger(kind=c_int)parameterLines.

Derived Types ​

view3d_object ​

A 3-D view: v%init, meshes added, then v%draw every frame. Not to be copied (the copy would share the view).

Components

NameTypeAttributesDescription
handleinteger(kind=c_int)Native handle (0: none).

Type-Bound Procedures

NameAttributesDescription
initpass(self)Create the view.
destroypass(self)Release it.
is_initializedpass(self)Whether it exists.
trianglespass(self)Add a triangle mesh.
quadspass(self)Add a quad mesh.
surfacepass(self)Add a structured surface.
linespass(self)Add lines.
set_meshpass(self)Change a mesh's scalar or style.
removepass(self)Remove a mesh.
clearpass(self)Remove every mesh.
changedpass(self)The data of a mesh changed in place.
set_camerapass(self)Set the camera.
get_camerapass(self)Read the camera.
fitpass(self)Fit the meshes in the view.
viewpass(self)One of the six standard views.
orbitpass(self)Turn the camera around its target.
panpass(self)Move the camera and its target across the screen.
zoompass(self)Move the camera toward its target.
clippass(self)Add a clipping plane.
unclippass(self)Remove the clipping planes.
drawpass(self)Draw the view as a widget.
pickpass(self)The element under a pixel.
hoveredpass(self)The element under the mouse.
clickedpass(self)The element clicked.
imagepass(self)The pixels of the last render.
render_infopass(self)Renders so far, the last one's time and size.
view_cubepass(self)A view cube over the view, turning the camera.
gizmopass(self)A gizmo moving a matrix, over the view.
view_matrixpass(self)The camera's view matrix.
projection_matrixpass(self)The camera's projection matrix.

Interfaces ​

fig_view3d_create ​

fig_view3d_mesh ​

fig_view3d_scalar ​

fig_view3d_style ​

fig_view3d_remove ​

fig_view3d_changed ​

fig_view3d_camera ​

fig_view3d_fit ​

fig_view3d_standard ​

fig_view3d_move ​

fig_view3d_clip ​

fig_view3d_unclip ​

fig_view3d_draw ​

fig_view3d_pick ​

fig_view3d_image ​

fig_view3d_matrices ​

fig_view3d_cube ​

fig_view3d_gizmo ​

fig_view3d_info ​

fig_view3d_cache ​

fig_view3d_destroy ​

Subroutines ​

init ​

Create the view (an existing one is destroyed first). After app%init*. Statuses: FIG_ERR_ARGUMENT for threads outside [1, 16]; FIG_ERR_STATE from a task. The same in every mode.

Attributes: recursive

fortran
subroutine init(self, threads, fast_moves, lighting, background, stat)

Arguments

NameTypeIntentAttributesDescription
selfclass(view3d_object)inoutView.
threadsinteger(kind=int32)inoptionalThreads rendering blocks of rows, in [1, 16] (default 1).
fast_moveslogicalinoptionalHalf resolution while the user moves the camera (default true).
lightinglogicalinoptionalShade by a light at the eye (default true); off: the colours as given.
backgroundreal(kind=real64)intarget, optionalBackground [r, g, b] in [0, 1] (default: the style's window background).
statinteger(kind=int32)outoptionalStatus.

Call graph

destroy ​

Release the view and its textures (safe in any state; the program's arrays are not touched).

fortran
subroutine destroy(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(view3d_object)inoutView.

Call graph

set_mesh ​

Change a mesh: its scalar (per vertex, per cell, or none), colormap, range (vmin, vmax together, or auto_range: the data's), colour, edges and their colour, shading, visibility. Arguments absent: unchanged. For a structured surface, pass its scalar as a contiguous array of ni*nj (or (ni-1)*(nj-1)) values. Statuses: FIG_ERR_ARGUMENT for an unknown mesh, a colormap name or a scalar size, vmax <= vmin or one of them alone.

Attributes: recursive

fortran
subroutine set_mesh(self, mesh, scalar, cell_scalar, no_scalar, colormap, vmin, vmax, auto_range, color, edges, edge_color, flat, visible, stat)

Arguments

NameTypeIntentAttributesDescription
selfclass(view3d_object)inView.
meshinteger(kind=int32)inMesh id.
scalarreal(kind=real64)intarget, optionalA value per vertex (node).
cell_scalarreal(kind=real64)intarget, optionalA value per cell.
no_scalarlogicalinoptionalTrue: no scalar (the mesh's colour).
colormapcharacter(len=*)inoptionalColormap name.
vminreal(kind=real64)inoptionalThe scalar mapped to the map's start.
vmaxreal(kind=real64)inoptional... to its end.
auto_rangelogicalinoptionalTrue: the data's range (the default).
colorreal(kind=real64)intarget, optionalColour [r, g, b] in [0, 1].
edgeslogicalinoptionalDraw the edges.
edge_colorreal(kind=real64)intarget, optionalEdges' colour (default near black).
flatlogicalinoptionalFlat shading.
visiblelogicalinoptionalDrawn (default true).
statinteger(kind=int32)outoptionalStatus.

Call graph

remove ​

Remove a mesh (the program's arrays are not touched). Status: FIG_ERR_ARGUMENT for an unknown mesh.

Attributes: recursive

fortran
subroutine remove(self, mesh, stat)

Arguments

NameTypeIntentAttributesDescription
selfclass(view3d_object)inView.
meshinteger(kind=int32)inMesh id.
statinteger(kind=int32)outoptionalStatus.

Call graph

clear ​

Remove every mesh.

Attributes: recursive

fortran
subroutine clear(self, stat)

Arguments

NameTypeIntentAttributesDescription
selfclass(view3d_object)inView.
statinteger(kind=int32)outoptionalStatus.

Call graph

changed ​

The data of mesh (absent: of every mesh) changed in place: its normals, range and connectivity checks are derived again, and the view is rendered at the next draw. Status: FIG_ERR_ARGUMENT for an unknown mesh or a connectivity index now out of range.

Attributes: recursive

fortran
subroutine changed(self, mesh, stat)

Arguments

NameTypeIntentAttributesDescription
selfclass(view3d_object)inView.
meshinteger(kind=int32)inoptionalMesh id.
statinteger(kind=int32)outoptionalStatus.

Call graph

set_camera ​

Set the camera: it looks at target from distance away, from the direction given by azimuth (around z, from +x toward +y) and elevation (above the x-y plane, in [-90, 90]), with a vertical field of view fov; z is up. Absent arguments are unchanged (a camera never set is first fitted to the meshes). Statuses: FIG_ERR_ARGUMENT for distance <= 0, fov outside (0, 180) or elevation outside [-90, 90].

Attributes: recursive

fortran
subroutine set_camera(self, target, distance, azimuth, elevation, fov, stat)

Arguments

NameTypeIntentAttributesDescription
selfclass(view3d_object)inView.
targetreal(kind=real64)inoptionalThe point looked at [world units].
distancereal(kind=real64)inoptionalFrom the target [world units].
azimuthreal(kind=real64)inoptional[degrees].
elevationreal(kind=real64)inoptional[degrees].
fovreal(kind=real64)inoptionalVertical field of view [degrees] (default 30).
statinteger(kind=int32)outoptionalStatus.

Call graph

get_camera ​

Read the camera (as set_camera describes it; a camera never set is first fitted to the meshes).

Attributes: recursive

fortran
subroutine get_camera(self, target, distance, azimuth, elevation, fov, stat)

Arguments

NameTypeIntentAttributesDescription
selfclass(view3d_object)inView.
targetreal(kind=real64)outoptionalThe point looked at.
distancereal(kind=real64)outoptionalFrom the target.
azimuthreal(kind=real64)outoptional[degrees], in [-180, 180].
elevationreal(kind=real64)outoptional[degrees].
fovreal(kind=real64)outoptional[degrees].
statinteger(kind=int32)outoptionalStatus.

Call graph

fit ​

Aim at the centre of the visible meshes' bounding box, from the distance at which their bounding sphere fills the view (the direction is kept). Also on a double click in the view.

Attributes: recursive

fortran
subroutine fit(self, stat)

Arguments

NameTypeIntentAttributesDescription
selfclass(view3d_object)inView.
statinteger(kind=int32)outoptionalStatus.

Call graph

view ​

A standard view, fitted: '+x' puts the eye on the +x side looking toward -x (z up), likewise '-x', '+y', '-y'; '+z' looks down with x right and y up, '-z' looks up with x right. Status: FIG_ERR_ARGUMENT for another name.

Attributes: recursive

fortran
subroutine view(self, name, stat)

Arguments

NameTypeIntentAttributesDescription
selfclass(view3d_object)inView.
namecharacter(len=*)in'+x', '-x', '+y', '-y', '+z' or '-z'.
statinteger(kind=int32)outoptionalStatus.

Call graph

orbit ​

Turn the camera around its target by azimuth and elevation [degrees] (the elevation is kept in [-90, 90]); as a drag with the left button in the view.

Attributes: recursive

fortran
subroutine orbit(self, azimuth, elevation, stat)

Arguments

NameTypeIntentAttributesDescription
selfclass(view3d_object)inView.
azimuthreal(kind=real64)inChange of azimuth [degrees].
elevationreal(kind=real64)inoptionalChange of elevation [degrees] (default 0).
statinteger(kind=int32)outoptionalStatus.

Call graph

pan ​

Move the camera and its target along the screen's right and up directions [world units]; as a drag with the right or middle button (or shift and the left one) in the view.

Attributes: recursive

fortran
subroutine pan(self, right, up, stat)

Arguments

NameTypeIntentAttributesDescription
selfclass(view3d_object)inView.
rightreal(kind=real64)inAlong the screen's right [world units].
upreal(kind=real64)inAlong the screen's up [world units].
statinteger(kind=int32)outoptionalStatus.

Call graph

zoom ​

Divide the camera's distance by factor (> 1 closer); the wheel in the view zooms by 1.1 per step. Status: FIG_ERR_ARGUMENT for factor <= 0.

Attributes: recursive

fortran
subroutine zoom(self, factor, stat)

Arguments

NameTypeIntentAttributesDescription
selfclass(view3d_object)inView.
factorreal(kind=real64)inZoom factor.
statinteger(kind=int32)outoptionalStatus.

Call graph

clip ​

Add a clipping plane through point: what lies where (x - point) . normal >= 0 is kept, the rest is cut away (surfaces cut exactly per pixel, lines per segment). At most 6 planes. Status: FIG_ERR_ARGUMENT for a seventh plane or a zero normal.

Attributes: recursive

fortran
subroutine clip(self, normal, point, stat)

Arguments

NameTypeIntentAttributesDescription
selfclass(view3d_object)inView.
normalreal(kind=real64)inTowards the part kept.
pointreal(kind=real64)inA point of the plane [world units].
statinteger(kind=int32)outoptionalStatus.

Call graph

unclip ​

Remove every clipping plane.

Attributes: recursive

fortran
subroutine unclip(self, stat)

Arguments

NameTypeIntentAttributesDescription
selfclass(view3d_object)inView.
statinteger(kind=int32)outoptionalStatus.

Call graph

draw ​

Draw the view as a widget at the cursor, inside a window: width x height pixels (0: the available region; negative: up to that distance from its edge). It is rendered only when something changed since the last draw. The mouse in the view: left drag orbits, right or middle drag (or shift and left) pans, the wheel zooms, a double click fits. While the user moves the camera, the view is rendered at half resolution (unless init's fast_moves=.false.), until the button is released or a frame has no wheel step. Modes: the same pixels in every mode; in remote mode each render is sent to the browser as a texture: JPEG while the camera moves, exact once it is still (init_remote's lossy). Statuses: FIG_ERR_STATE before init and from a task.

Attributes: recursive

fortran
subroutine draw(self, id, width, height, stat)

Arguments

NameTypeIntentAttributesDescription
selfclass(view3d_object)inView.
idcharacter(len=*)inWidget id (unique in the window).
widthreal(kind=real64)inoptionalWidth [pixels] (default 0: the available width).
heightreal(kind=real64)inoptionalHeight [pixels] (default 0: the available height).
statinteger(kind=int32)outoptionalStatus.

Call graph

image ​

The pixels of the last render, rgba(4, width, height) (as texture_object%update takes them; half the view's size if it was rendered while moving), unallocated before the first render.

Attributes: recursive

fortran
subroutine image(self, rgba, stat)

Arguments

NameTypeIntentAttributesDescription
selfclass(view3d_object)inView.
rgbainteger(kind=int8)outallocatable, targetPixels.
statinteger(kind=int32)outoptionalStatus.

Call graph

render_info ​

The renders so far, the last one's time [ms] and size [pixels], whether it was at half resolution, and the bytes the per-render caches hold (64 a vertex, and the bands' triangle lists; freed after 30 draws without a render).

Attributes: recursive

fortran
subroutine render_info(self, count, milliseconds, width, height, half, cache_bytes, stat)

Arguments

NameTypeIntentAttributesDescription
selfclass(view3d_object)inView.
countinteger(kind=int32)outoptionalRenders since init.
millisecondsreal(kind=real64)outoptionalThe last render's time [ms].
widthinteger(kind=int32)outoptionalIts width [pixels].
heightinteger(kind=int32)outoptionalIts height [pixels].
halflogicaloutoptionalAt half resolution (the camera was moving).
cache_bytesinteger(kind=int64)outoptionalThe per-render caches' bytes.
statinteger(kind=int32)outoptionalStatus.

Call graph

view_cube ​

A view cube (ImGuizmo's ViewManipulate) in a corner of the view, drawn over its image: call it after draw, in the same window and frame. A click on a face turns the camera to look at it (the eye on that side), a click on an edge or a corner between the faces it touches, over 40 frames; a drag on the cube orbits the camera. The camera's target and distance are kept. The faces take the gizmos' axis colours: red the two of x, green of y, blue of z. While the pointer is over the cube, the view does not take the mouse. Polled: the camera changes, as get_camera reads. Statuses: FIG_ERR_STATE if the view was not drawn in this frame and window, outside a frame and from a task; FIG_ERR_ARGUMENT for a size not above 0 or an unknown corner. The same in every mode.

Attributes: recursive

fortran
subroutine view_cube(self, size, corner, stat)

Arguments

NameTypeIntentAttributesDescription
selfclass(view3d_object)inView.
sizereal(kind=real64)inoptionalSide [pixels] (default 96; at most the view's).
cornercharacter(len=*)inoptional'top-right' (default), 'top-left', 'bottom-right', 'bottom-left'.
statinteger(kind=int32)outoptionalStatus.

Call graph

view_matrix ​

The camera's view matrix: world to eye coordinates, column-major 4x4 with column vectors (OpenGL's convention, and ImGuizmo's): m(1:3, 1:3) the rotation, whose rows are the screen's right, up and the direction from the target to the eye, m(1:3, 4) the translation; the eye looks down its -z. As the camera is now (set_camera, orbit, a view cube); a camera never set is first fitted to the meshes.

Attributes: recursive

fortran
subroutine view_matrix(self, m, stat)

Arguments

NameTypeIntentAttributesDescription
selfclass(view3d_object)inView.
mreal(kind=real64)outView matrix.
statinteger(kind=int32)outoptionalStatus.

Call graph

projection_matrix ​

The camera's perspective projection: eye to clip coordinates, column-major 4x4 (OpenGL's convention: clip z in [-w, w], m(4, 3) = -1), for the view's size at its last draw (1 x 1 before the first) and its vertical field of view; the near and far planes enclose the visible meshes' bounding sphere, so they change with the meshes and the camera. The image is projection_matrix * view_matrix applied to world points.

Attributes: recursive

fortran
subroutine projection_matrix(self, m, stat)

Arguments

NameTypeIntentAttributesDescription
selfclass(view3d_object)inView.
mreal(kind=real64)outProjection matrix.
statinteger(kind=int32)outoptionalStatus.

Call graph

style_new ​

The scalars and style given at a mesh's creation; the mesh is removed again on a failure.

fortran
subroutine style_new(self, mesh, scalar, cell_scalar, colormap, color, edges, flat, stat)

Arguments

NameTypeIntentAttributesDescription
selfclass(view3d_object)inView.
meshinteger(kind=int32)inoutMesh id (0 after a failure).
scalarreal(kind=real64)intarget, optionalA value per vertex.
cell_scalarreal(kind=real64)intarget, optionalA value per cell.
colormapcharacter(len=*)inoptionalColormap.
colorreal(kind=real64)inoptionalColour.
edgeslogicalinoptionalEdges.
flatlogicalinoptionalFlat shading.
statinteger(kind=int32)outoptionalStatus.

Call graph

Functions ​

is_initialized ​

Whether the view exists.

Attributes: pure

Returns: logical

fortran
function is_initialized(self) result(yes)

Arguments

NameTypeIntentAttributesDescription
selfclass(view3d_object)inView.

Call graph

triangles ​

Add a mesh of triangles: vertex k at xyz(:, k), triangle t joining the vertices tri(:, t) (from 1). Returns the mesh's id (from 1; 0 on a failure). The arrays are kept by address (see the module's notes on data in place). Statuses: FIG_ERR_ARGUMENT for a non-contiguous array, an index outside [1, size(xyz, 2)] or a scalar of the wrong size; FIG_ERR_STATE before init and from a task.

Attributes: recursive

Returns: integer(kind=int32)

fortran
function triangles(self, xyz, tri, scalar, cell_scalar, colormap, color, edges, flat, stat) result(mesh)

Arguments

NameTypeIntentAttributesDescription
selfclass(view3d_object)inView.
xyzreal(kind=real64)intargetVertices, xyz(3, nv).
triinteger(kind=int32)intargetTriangles, tri(3, nt).
scalarreal(kind=real64)intarget, optionalA value per vertex, by the colormap.
cell_scalarreal(kind=real64)intarget, optionalA value per triangle (one colour each).
colormapcharacter(len=*)inoptionalColormap name (default 'cividis').
colorreal(kind=real64)inoptionalColour without a scalar [r, g, b].
edgeslogicalinoptionalDraw the triangles' edges (default false).
flatlogicalinoptionalFlat shading (default false: smooth).
statinteger(kind=int32)outoptionalStatus.

Call graph

quads ​

Add a mesh of quadrilaterals quad(4, nq) (vertices from 1, in order around each), each drawn as two triangles; as triangles otherwise. A picked element is a quad.

Attributes: recursive

Returns: integer(kind=int32)

fortran
function quads(self, xyz, quad, scalar, cell_scalar, colormap, color, edges, flat, stat) result(mesh)

Arguments

NameTypeIntentAttributesDescription
selfclass(view3d_object)inView.
xyzreal(kind=real64)intargetVertices, xyz(3, nv).
quadinteger(kind=int32)intargetQuads, quad(4, nq).
scalarreal(kind=real64)intarget, optionalA value per vertex.
cell_scalarreal(kind=real64)intarget, optionalA value per quad.
colormapcharacter(len=*)inoptionalColormap name (default 'cividis').
colorreal(kind=real64)inoptionalColour without a scalar [r, g, b].
edgeslogicalinoptionalDraw the quads' edges (default false).
flatlogicalinoptionalFlat shading (default false).
statinteger(kind=int32)outoptionalStatus.

Call graph

surface ​

Add a structured surface: node (i, j) at xyz(:, i, j), cells between neighbouring nodes (a grid's face, a body's patch). scalar(ni, nj) per node, or cell_scalar(ni-1, nj-1) per cell; edges draws the grid lines. A picked element is the cell i + (j - 1) * (ni - 1). As triangles otherwise.

Attributes: recursive

Returns: integer(kind=int32)

fortran
function surface(self, xyz, scalar, cell_scalar, colormap, color, edges, flat, stat) result(mesh)

Arguments

NameTypeIntentAttributesDescription
selfclass(view3d_object)inView.
xyzreal(kind=real64)intargetNodes, xyz(3, ni, nj).
scalarreal(kind=real64)intarget, optionalA value per node, (ni, nj).
cell_scalarreal(kind=real64)intarget, optionalA value per cell, (ni-1, nj-1).
colormapcharacter(len=*)inoptionalColormap name (default 'cividis').
colorreal(kind=real64)inoptionalColour without a scalar.
edgeslogicalinoptionalDraw the grid lines (default false).
flatlogicalinoptionalFlat shading (default false).
statinteger(kind=int32)outoptionalStatus.

Call graph

lines ​

Add lines, one pixel wide: the segments seg(2, ns) (vertices from 1), or without seg the polyline through the points in order. Coloured by scalar per point, cell_scalar per segment, or color (default light grey). Lines are not picked and do not hide what is behind them. As triangles otherwise.

Attributes: recursive

Returns: integer(kind=int32)

fortran
function lines(self, xyz, seg, scalar, cell_scalar, colormap, color, stat) result(mesh)

Arguments

NameTypeIntentAttributesDescription
selfclass(view3d_object)inView.
xyzreal(kind=real64)intargetPoints, xyz(3, np).
seginteger(kind=int32)intarget, optionalSegments, seg(2, ns).
scalarreal(kind=real64)intarget, optionalA value per point.
cell_scalarreal(kind=real64)intarget, optionalA value per segment.
colormapcharacter(len=*)inoptionalColormap name (default 'cividis').
colorreal(kind=real64)inoptionalColour without a scalar [r, g, b].
statinteger(kind=int32)outoptionalStatus.

Call graph

pick ​

The element under the pixel (x, y) of the view (from its top-left corner) in the last render: true if a surface is there, with its mesh id, its element (triangle, quad or cell, from 1) and the point hit [world units].

Attributes: recursive

Returns: logical

fortran
function pick(self, x, y, mesh, element, point, stat) result(hit)

Arguments

NameTypeIntentAttributesDescription
selfclass(view3d_object)inView.
xreal(kind=real64)inAbscissa from the view's left [pixels].
yreal(kind=real64)inOrdinate from the view's top [pixels].
meshinteger(kind=int32)outMesh id (0: none).
elementinteger(kind=int64)outElement (0: none).
pointreal(kind=real64)outoptionalThe point hit.
statinteger(kind=int32)outoptionalStatus.

Call graph

hovered ​

The element under the mouse in the last draw (false when the mouse is not over a surface of the view).

Attributes: recursive

Returns: logical

fortran
function hovered(self, mesh, element, point, stat) result(hit)

Arguments

NameTypeIntentAttributesDescription
selfclass(view3d_object)inView.
meshinteger(kind=int32)outMesh id (0: none).
elementinteger(kind=int64)outElement (0: none).
pointreal(kind=real64)outoptionalThe point under the mouse.
statinteger(kind=int32)outoptionalStatus.

Call graph

clicked ​

The element clicked (left button pressed and released without dragging) in the last draw: true in that frame.

Attributes: recursive

Returns: logical

fortran
function clicked(self, mesh, element, point, stat) result(hit)

Arguments

NameTypeIntentAttributesDescription
selfclass(view3d_object)inView.
meshinteger(kind=int32)outMesh id (0: none).
elementinteger(kind=int64)outElement (0: none).
pointreal(kind=real64)outoptionalThe point clicked.
statinteger(kind=int32)outoptionalStatus.

Call graph

gizmo ​

A gizmo (ImGuizmo's Manipulate) moving matrix, drawn over the view's image at the point the matrix places: call it after draw, in the same window and frame, once a frame for as long as the gizmo is shown. mode'translate' shows three arrows (along an axis) and three squares (in a plane), 'rotate' three circles (about an axis) and one facing the eye, 'scale' three handles; space 'world' orients them along the world's axes, 'local' along the matrix's own (scale is always local). snap rounds the motion of a drag to a step: world units, degrees or a scale step. True on the frames the user moved it, with matrix updated; untouched on the others. While the pointer is over a handle (from the frame after it reaches it) or a drag goes on, the view does not take the mouse. matrix is column-major as the view's (view_matrix): matrix(1:3, 1:3) the rotation and scale, matrix(1:3, 4) the translation, matrix(4, :) = (0, 0, 0, 1); a clipping plane at matrix(1:3, 4) with normal matrix(1:3, 3) follows it (unclip, then clip). ImGuizmo works in single precision: a moved matrix is rounded to real32 relative to the camera's target (about 1e-7 of the scene's size). Statuses: FIG_ERR_STATE if the view was not drawn in this frame and window, outside a frame and from a task; FIG_ERR_ARGUMENT for an unknown mode or space, a snap not above 0, a matrix not finite or whose last row is not (0, 0, 0, 1). The same in every mode.

Attributes: recursive

Returns: logical

fortran
function gizmo(self, id, matrix, mode, space, snap, stat) result(changed)

Arguments

NameTypeIntentAttributesDescription
selfclass(view3d_object)inView.
idcharacter(len=*)inGizmo id (unique in the window).
matrixreal(kind=real64)inoutThe placement moved [world units].
modecharacter(len=*)inoptional'translate' (default), 'rotate', 'scale'.
spacecharacter(len=*)inoptional'world' (default), 'local'.
snapreal(kind=real64)inoptionalStep of a drag [world units, degrees or factor].
statinteger(kind=int32)outoptionalStatus.

Call graph

alive ​

The view exists; else FIG_ERR_STATE.

Returns: logical

fortran
function alive(self, name, stat) result(ok)

Arguments

NameTypeIntentAttributesDescription
selfclass(view3d_object)inView.
namecharacter(len=*)inProcedure.
statinteger(kind=int32)outoptionalStatus.

Call graph

points_ok ​

xyz(3, n), n >= 1, contiguous.

Returns: logical

fortran
function points_ok(name, xyz, stat) result(ok)

Arguments

NameTypeIntentAttributesDescription
namecharacter(len=*)inProcedure.
xyzreal(kind=real64)inPoints.
statinteger(kind=int32)outoptionalStatus.

Call graph

connectivity_ok ​

xyz(3, n) and conn(per, m), m >= 1, both contiguous (the indices are checked by the native layer).

Returns: logical

fortran
function connectivity_ok(name, xyz, conn, per, stat) result(ok)

Arguments

NameTypeIntentAttributesDescription
namecharacter(len=*)inProcedure.
xyzreal(kind=real64)inPoints.
conninteger(kind=int32)inConnectivity.
perintegerinVertices per cell.
statinteger(kind=int32)outoptionalStatus.

Call graph

add_mesh ​

A mesh added by the native layer; 0 on a failure.

Returns: integer(kind=int32)

fortran
function add_mesh(self, kind, xyz, nv, conn, ncell, ni, nj, stat) result(mesh)

Arguments

NameTypeIntentAttributesDescription
selfclass(view3d_object)inView.
kindinteger(kind=c_int)inKind.
xyztype(c_ptr)inCoordinates.
nvinteger(kind=int64)inVertices.
conntype(c_ptr)inConnectivity (or null).
ncellinteger(kind=int64)inCells.
niintegerinSurface's nodes.
njintegerinSurface's nodes.
statinteger(kind=int32)outoptionalStatus.

Call graph

scalar_set ​

The native scalar of a mesh set (values null: removed); false on a failure.

Returns: logical

fortran
function scalar_set(self, mesh, values, n, on_cells, stat) result(ok)

Arguments

NameTypeIntentAttributesDescription
selfclass(view3d_object)inView.
meshinteger(kind=int32)inMesh id.
valuestype(c_ptr)inThe values.
ninteger(kind=int64)inTheir number.
on_cellslogicalinPer cell.
statinteger(kind=int32)outoptionalStatus.

Call graph

flag ​

-1 for absent, else 0 or 1.

Returns: integer(kind=c_int)

fortran
function flag(value) result(f)

Arguments

NameTypeIntentAttributesDescription
valuelogicalinoptionalValue.

Call graph

query ​

pick (0), hovered (1), clicked (2).

Attributes: recursive

Returns: logical

fortran
function query(self, name, what, x, y, mesh, element, point, stat) result(hit)

Arguments

NameTypeIntentAttributesDescription
selfclass(view3d_object)inView.
namecharacter(len=*)inProcedure.
whatinteger(kind=c_int)inWhich.
xreal(kind=real64)inPixel.
yreal(kind=real64)inPixel.
meshinteger(kind=int32)outMesh id.
elementinteger(kind=int64)outElement.
pointreal(kind=real64)outoptionalPoint.
statinteger(kind=int32)outoptionalStatus.

Call graph

Released under the MIT licence.