modules

geometor.explorer

Web-based interface and canonical SVG renderer for GEOMETOR models.

The geometor.explorer package provides:

  • Canonical Renderer (render): Pure-Python Model -> SVG renderer using Explorer’s 5-layer stack, unified --geom-* tokens, Liang-Barsky infinite-line clipping, 3-vertex midpoint paths, and 8-slot anti-crowding labels.

  • Serialization (serialize): Converts exact SymPy models into browser-ready JSON payloads.

  • Interactive Workbench (app): Flask server built on the reusable GeometorStage engine and MathJax v4.

Submodules

Attributes

__version__

Functions

get_static_asset_paths() → dict[str, pathlib.Path]

Return canonical paths to Explorer's shared CSS and JS runtime assets.

render_model_svg(model_or_dict, *[, view_box, theme, ...]) → str

Render a geometor.model.Model (or serialized dict) into a canonical Explorer SVG.

write_model_svg(model_or_dict, output_path, **kwargs) → pathlib.Path

Render a model and write the canonical SVG to output_path.

Package Contents

geometor.explorer.get_static_asset_paths() → dict[str, pathlib.Path]

Return canonical paths to Explorer’s shared CSS and JS runtime assets.

geometor.explorer.render_model_svg(model_or_dict: geometor.model.Model | dict[str, Any], *, view_box: tuple[float, float, float, float] | None = None, theme: str | None = None, graphic_id: str | None = None, classes: list[str] | None = None, include_style: bool = False, embed_model_json: bool = False, clip_lines: bool = True, three_vertex_segments: bool = True, smart_labels: bool = True, include_markers: bool = True, width: str | None = None, height: str | None = None, ref_width_px: float = 800.0) → str

Render a geometor.model.Model (or serialized dict) into a canonical Explorer SVG.

Uses the Explorer 5-layer stack (graphics -> highlights -> elements -> points -> labels), Y-up Cartesian math coordinates (explicit -y), Liang-Barsky clipped infinite lines, 3-vertex midpoint segment paths, 8-slot anti-crowding labels, and zero inline JavaScript.

Parameters:
  • model_or_dict – A geometor.model.Model instance or to_browser_dict payload.

  • view_box – Optional explicit (x, y, w, h) SVG viewBox.

  • theme – Optional data-geom-theme ("dark", "light", "parchment", "print", "broadcast").

  • graphic_id – Optional data-graphic-id attribute (defaults to model name or "g1").

  • classes – Optional extra classes for the root <svg> element.

  • include_style – When True, embeds canonical geometor-svg.css inside <style>.

  • embed_model_json – When True, embeds <script type="application/json" class="geometor-model-data"> for zero-server hydration in GeometorStage.

  • clip_lines – When True, clips infinite lines analytically via Liang-Barsky.

  • three_vertex_segments – When True, emits segments as 3-vertex midpoint <path>.

  • smart_labels – When True, applies 8-slot anti-crowding label placement.

  • include_markers – When True, emits <defs> endpoint and equality tick markers.

  • width – Optional explicit SVG width attribute (e.g. "680" or "11in").

  • height – Optional explicit SVG height attribute.

  • ref_width_px – Reference CSS pixel width used for initial point/marker/label sizing.

Returns:

Complete canonical SVG XML string.

geometor.explorer.write_model_svg(model_or_dict: geometor.model.Model | dict[str, Any], output_path: str | pathlib.Path, **kwargs: Any) → pathlib.Path

Render a model and write the canonical SVG to output_path.

geometor.explorer.__version__ = '0.6.0'