gds_fdtd.viewer3d

gds_fdtd simulation toolbox.

Interactive 3D viewer: the component’s extruded layer stack, its ports, the field-monitor planes, and the simulation domain in one orbitable scene.

The scene is built in Python as plain JSON (polygon contours + z extents; no new dependencies) and rendered by three.js in a self-contained HTML snippet. The same snippet works everywhere an HTML output renders: Jupyter (via show_3d), the Sphinx docs gallery (myst-nb passes it through), or a standalone file (save_3d). Clicking an object shows its name, material, layer, and z-extent; the legend toggles each group. render_static draws the identical scene with matplotlib for contexts that cannot run JavaScript (the README, PDF exports).

Geometry note: structures render as vertical extrusions of their footprint (sidewall angles are not shown; engines still simulate them).

Functions

build_scene(obj)

Build the JSON scene for a solver or a bare component.

render_static(obj[, ax, elev, azim, savefig])

Matplotlib 3D rendering of the same scene (no JavaScript required).

save_3d(obj, path[, height, title])

Write the viewer as a standalone HTML page (for docs or sharing).

scene_html(scene[, height])

The interactive viewer as a self-contained HTML snippet (three.js via CDN).

show_3d(obj[, height])

Display the interactive 3D scene in a notebook (and in the docs gallery).