Arrangement Visualization (display_arrangement.py)

The display_arrangement module provides visualization routines for rendering 2D CGAL arrangements (Arrangement_2), halfedges, vertices, faces, and overlay traits on Matplotlib plots or PySide Qt canvas graphics views.

Architectural Role & Debugging Workflows

  • Arrangement Inspection: Renders arrangement halfedges, faces, and vertex points during exact solver debugging (e.g., inspecting vertical decomposition in ExactSingle).

  • GUI Integration: Used by discopygal.gui and tools.solver_viewer to draw sub-division faces, arrangement overlays, and C-obstacle boundaries.

Key Functions

  • display_arrangement(arr, title="Arrangement", block=True): Renders a 2D CGAL arrangement using Matplotlib, drawing vertices as red points, halfedges as blue line segments, and unbounded faces.

  • draw_face(face, ax, color="lightgray"): Renders a specific arrangement face polygon onto a Matplotlib axis.

Usage Example

from discopygal.geometry_utils.display_arrangement import display_arrangement

# Display exact arrangement faces on a Matplotlib plot
display_arrangement(exact_solver.get_arrangement(), title="Vertical Decomposition Arrangement")

API Reference

This module can be used to display an arrangement on a new window

class discopygal.geometry_utils.display_arrangement.GUIArrangement

Bases: GUI

setupUi() None

Setup the UI layout of the application. Should be overridded by any GUI application and define a custom layout.

discopygal.geometry_utils.display_arrangement.display_arrangement(arr: Arrangement_2, display_name: str = 'Display Arrangement', show_grid: bool = False, zoom: int = 50, grid_resolution: float = 1.0) None

Get an arrangement and open a window that displays it. Useful for debugging.

For faces with data that is an int:

Faces with data >= 0 are colored green (free/valid). Faces with data < 0 are colored red (occupied/invalid).

For faces with data that is a bool:

Faces with data True are colored green (free/valid). Faces with data False are colored red (occupied/invalid).

Unbounded faces are left white.

Parameters:
  • arr (Arrangement_2) – Arrangement to display

  • display_name (str) – Name of display window

  • show_grid (bool) – Should show grid

  • zoom (int) – Amount of initial zoom

  • grid_resolution – What is the resolution of the grid lines (spacing between the lines).

  • grid_resolutionfloat