Private API

Common methods

GridVisualizeTools.extract_visible_bfaces3DMethod
extract_visible_bfaces3D(
    grid,
    xyzcut;
    gridscale,
    primepoints,
    Tp,
    Tf
)

Extract visible boundary faces - those not cut off by the planes x=xyzcut[1] or y=xyzcut[2] or z=xyzcut[3].

Return corresponding points and facets for each region for drawing as mesh (Makie,MeshCat) or trisurf (pyplot)

source
GridVisualizeTools.extract_visible_cells3DMethod
extract_visible_cells3D(
    grid,
    xyzcut;
    cellcoloring,
    gridscale,
    primepoints,
    Tp,
    Tf
)

Extract visible tetrahedra - those intersecting with the planes x=xyzcut[1] or y=xyzcut[2] or z=xyzcut[3].

Return corresponding points and facets for each region for drawing as mesh (Makie,MeshCat) or trisurf (pyplot)

source
GridVisualize.compute_2d_rotation_matrixMethod
compute_2d_rotation_matrix(target_vector)
Compute and return a rotation matrix 𝐑²ˣ²
which rotates the second unit vector y = [0, 1]ᵀ
in the direction of a given target_vector t ∈ 𝐑²

target_vector: vector with 2 components (not necessarily of unit length)
source
GridVisualize.compute_3d_z_rotation_matrixMethod
compute_3d_z_rotation_matrix(target_vector)
Compute and return a rotation matrix 𝐑³ˣ³
which rotates the third unit vector z = [0, 0, 1]ᵀ
in the direction of a given target_vector t ∈ 𝐑³

target_vector: vector with 3 components (not necessarily of unit length)
source
GridVisualize.eval_slice_expr!Method
eval_slice_expr!(vec, pair)
Provide a Symbol-Number pair as a slice expression.
Allowed symbols are :x, :y and :z.

Example:
  -  :x = 4 becomes :(x - 4)
  -  :y = -3 becomes :(y + 3)
source
GridVisualize.eval_slice_expr!Method
eval_slice_expr!(vec, expr)
Evaluate an expression of the form :(αx ± βy ± γz ± δ)
and compute the vector vec = [ α, β, γ, δ ].

At least one nonzero symbol :x, :y or :z needs to be present.
Providing a :z symbol assumes that length(vec) == 4.

Examples:
  -  :(x-3) => [ 1, 0, 0, -3 ]
  -  :(2x - z + 3)  => [2, 0, 1, 3]
source
GridVisualize.slice_plot!Method
slice_plot!(ctx, _, grid, values)
Extract a 1D line plot from a 2D plot

The intersection of the given 2D grid with a given line is computed and rotated onto the
first coordinate axis.

For a simple line (x = const / y = const) the original coordinates of the other axis are
preserved.

Else, for a generic line, the new axis has non-negative values and starts at [0,0].

ctx:     plotting context
grid:    2D ExtendableGrid
values:  value vector corresponding to the grid nodes
line:    Vector [a,b,c], s.t., ax + by + d = 0 defines the line that slices the 2D grid
source
GridVisualize.slice_plot!Method
slice_plot!(ctx, _, grid, values)
Extract a 2D plane plot of a 3D plot

The intersection of the given 3D grid with a given plane is computed and rotated into a 2D
coordinate system.

For a simple plane (x = const / y = const / z = const) the original coordinates of the free
axes are preserved. The plotted axes order is in this case
    x = const: ( y, z )
    y = const: ( x, z )
    z = const: ( x, y )

Else, for a generic plane, the new coordinate system has non-negative values and start at [0,0].

ctx:     Plotting context
grid:    3D ExtendableGrid
values:  value vector corresponding to the grid nodes
plane:   Vector [a,b,c,d], s.t., ax + by + cz + d = 0 defines the plane that slices the 3D grid
source

PyPlot

Makie

GridVisualize.makeaxis3dMethod

makeaxis3d(ctx)

Dispatch between LScene and new Axis3. Axis3 does not allow zoom, so we support LScene in addition.

source
GridVisualize.makescene2dMethod

makescene2d(ctx)

Complete scene with title and status line showing interaction state. This uses a gridlayout and its protrusion capabilities.

source
GridVisualize.makescene3dMethod
   makescene3d(ctx)

Complete scene with title and status line showing interaction state. This uses a gridlayout and its protrusion capabilities.

source
GridVisualize.scene_interactionFunction
 scene_interaction(update_scene,view,switchkeys::Vector{Symbol}=[:nothing])

Control multiple scene elements via keyboard up/down keys. Each switchkey is assumed to correspond to one of these elements. Pressing a switch key transfers control to its associated element.

Control of values of the current associated element is performed by triggering change values via up/down (± 1) resp. pageup/pagedown (±10) keys

The update_scene callback gets passed the change value and the symbol.

source
GridVisualize.FlippableLayout.FLayoutType
mutable struct FLayout

Struct describing flippable layout data. We don't type annotate with Makie types as they are unknown at start time.

  • visible: Visible GridLayout
  • offscreen: Hidden GridLayot
  • blocked: Has the layout been blocked by the block key ?
  • layoutables: Layoutables attached to layout
  • condition: Condition variable working together with the blocked field.
source
GridVisualize.FlippableLayout.flayoutsceneMethod
flayoutscene(;blocked=false, kwargs...)

Layoutscene with interactive layout and blocking functionality.

The , key switches between focused view showing only one subscene and "gallery view" showing all layoutables at once.

The space key toggles blocking of the execution of the main therad when yield is replaced by yieldwait. Initial blocking state is set by the blocked kwarg.

The kwargs... are the same as of AbstractPlotting.layoutscene.

The idea is that this can work in some cases as a drop-in replacement of layoutscene.

source
GridVisualize.FlippableLayoutModule

This module is a submodule of GridVisualize.

It manages a layoutscene with interactive layout and blocking functionality.

Thanks to Julius Krumbiegel for providing a basic implementation of focus switching.

GridVisualize avoids creating dependencies on plotting backends. So we provide a way to emulate "import Makie" by allowing to set it as a global variable in the setmakie!. As a consequence, we can't use Makie types at compile time.

source

Plots

VTKView

Internals