geometor.menelaus.render

Publication-grade .euclid-graphic SVG renderer for 2D planar and 3D spherical Menelaus models.

Supports both:

  1. 2D Planar Model constructions (render_planar_svg(), export_planar_svg()), clipping infinite algebraic lines cleanly to a padded frame, rendering 3-vertex midpoint <path> segments, and avoiding point-label collisions.

  2. 3D Unit-Sphere \(S^2\) constructions (render_spherical_svg(), export_spherical_svg()), projecting exact SphericalPoint and GreatCircle elements orthographically onto 2D while preserving full interactive svg.euclid-graphic data-ref wiring for publish.

Attributes

EMBEDDED_SVG_STYLE

Functions

render_planar_svg(model, *[, graphic_id, width, ...]) → str

Render a 2D Model into a complete .euclid-graphic SVG string.

export_planar_svg(model, output_path, **kwargs) → pathlib.Path

Write a 2D Model SVG to output_path.

render_spherical_svg(*, points, arcs[, full_circles, ...]) → str

Render an orthographic 3D projection of \(S^2\) as an interactive .euclid-graphic SVG.

export_spherical_svg(output_path, **kwargs) → pathlib.Path

Write a 3D orthographic unit-sphere SVG to output_path.

Module Contents

geometor.menelaus.render.EMBEDDED_SVG_STYLE: str = ''
geometor.menelaus.render.render_planar_svg(model: geometor.model.Model, *, graphic_id: str = 'menelaus-planar', width: int = 760, height: int = 520, padding_px: float = 54.0, label_overrides: dict[str, str] | None = None) → str

Render a 2D Model into a complete .euclid-graphic SVG string.

geometor.menelaus.render.export_planar_svg(model: geometor.model.Model, output_path: pathlib.Path | str, **kwargs: Any) → pathlib.Path

Write a 2D Model SVG to output_path.

geometor.menelaus.render.render_spherical_svg(*, points: Sequence[tuple[geometor.menelaus.spherical.SphericalPoint, str]], arcs: Sequence[tuple[geometor.menelaus.spherical.SphericalPoint, geometor.menelaus.spherical.SphericalPoint, str, str]], full_circles: Sequence[tuple[geometor.menelaus.spherical.GreatCircle, str, str]] = (), graphic_id: str = 'menelaus-spherical', width: int = 640, height: int = 560, azimuth_deg: float = 36.0, elevation_deg: float = 24.0, label_overrides: dict[str, str] | None = None) → str

Render an orthographic 3D projection of \(S^2\) as an interactive .euclid-graphic SVG.

Parameters:
  • points – Sequence of (SphericalPoint, css_role) (e.g. "given", "trace result").

  • arcs – Sequence of (P, Q, css_role, data_ref) geodesic minor arcs on \(S^2\).

  • full_circles – Sequence of (GreatCircle, css_role, data_ref) full great circles (front/back split).

  • graphic_id – Interactive graphic ID.

  • width – SVG width in pixels.

  • height – SVG height in pixels.

  • azimuth_deg – Camera azimuth angle in degrees.

  • elevation_deg – Camera elevation angle in degrees.

  • label_overrides – Optional label text map.

geometor.menelaus.render.export_spherical_svg(output_path: pathlib.Path | str, **kwargs: Any) → pathlib.Path

Write a 3D orthographic unit-sphere SVG to output_path.