widgets
pleat.shrink_rotate.widgets ¶
Interactive widget for exploring shrink-rotate tessellations.
Requires the [notebook] extra (matplotlib + ipywidgets + ipympl).
Use inside a Jupyter notebook with %matplotlib widget.
ShrinkRotateExplorer ¶
ShrinkRotateExplorer(
SRG,
*,
alpha0: float = 1 / 6,
factor0: float = 0.58,
figsize: tuple[float, float] = (7, 7),
figure_id: str = "shrink-rotate"
)
Interactive shrink-rotate / reciprocal-figure explorer.
Build state once from an SRG (output of
:func:pleat.shrink_rotate.shrink_rotate_pattern), then offer sliders for
alpha and factor (or, in reparametrized mode, beta and
gamma) plus a few display toggles.
Vertex positions on the supplied SRG are mutated in place at each tick,
so downstream operations (e.g. fold_complete) see current geometry.
Parameters¶
SRG :
Shrink-rotate graph with base_pos on every vertex and
rotation_center on each twist face.
alpha0, factor0:
Initial slider values (alpha is in units of π).
figsize :
Matplotlib figure size.
figure_id :
Stable figure id; passed as num= to :func:plt.figure so
re-displaying replaces the previous figure rather than stacking.
Notes¶
Call :meth:display to show the widget. Public attributes figure,
alpha_slider, factor_slider etc. are exposed for further
customisation.
Source code in pleat/shrink_rotate/widgets.py
display ¶
Display the widget UI in a Jupyter notebook.
Re-displays the figure canvas explicitly, so re-executing a cell
that calls :meth:display keeps showing the plot (with
%matplotlib widget, the canvas widget from the previous
execution is otherwise orphaned).