Skip to content

Voronoi tree map - #20

Merged
thegreystone merged 11 commits into
mainfrom
voronoi
Jun 6, 2026
Merged

thegreystone merged 11 commits into
mainfrom
voronoi

Conversation

@thegreystone

Copy link
Copy Markdown
Owner

Adding another visualization mode (a Voronoi tree map visualization).

Copilot AI review requested due to automatic review settings June 6, 2026 01:15

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a third visualization mode (“Voronoi Treemap”) to DiskSpace, backed by a new weighted Voronoi/power-diagram layout engine and accompanied by UI integration, performance/LOD controls, and expanded JFR instrumentation to diagnose navigation/render latency.

Changes:

  • Introduce VoronoiLayout (weighted Voronoi treemap layout) plus regression tests for convergence/area properties.
  • Add VoronoiVisualization with LOD aggregation (“Smaller” cell), 2-level rendering, and drill animations; wire it into DiskView render-mode cycling.
  • Expand JFR instrumentation: siteCount reporting per visualization and a new Navigation duration event correlated to Render events via navId.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/test/java/se/hirt/diskspace/ui/VoronoiLayoutTest.java Adds regression tests validating Voronoi layout convergence/area expectations on real-world-like data.
src/main/java/se/hirt/diskspace/ui/VoronoiLayout.java New weighted Voronoi (power diagram) layout implementation with iterative balancing and polygon utilities.
src/main/java/se/hirt/diskspace/ui/render/VoronoiVisualization.java New Voronoi visualization renderer with LOD caps, sub-cells, hit-test cache, and drill animations.
src/main/java/se/hirt/diskspace/ui/render/Visualization.java Adds lastRenderSiteCount() API for reporting rendered/layout site count.
src/main/java/se/hirt/diskspace/ui/render/SunburstVisualization.java Implements lastRenderSiteCount() for sunburst sectors.
src/main/java/se/hirt/diskspace/ui/render/HeatmapVisualization.java Implements lastRenderSiteCount() for heatmap rectangles; formatting cleanups.
src/main/java/se/hirt/diskspace/ui/PickerView.java Comment wrapping/format cleanup.
src/main/java/se/hirt/diskspace/ui/DiskView.java Adds Voronoi render mode, wires visualization selection, and adds JFR Navigation + siteCount/navId fields.
src/main/java/se/hirt/diskspace/scan/MacBulkScanner.java Comment wrapping/format cleanup.
src/main/java/se/hirt/diskspace/scan/Darwin.java Comment wrapping/format cleanup.
src/main/java/se/hirt/diskspace/model/Volume.java Comment wrapping/format cleanup.
README.md Updates to reflect three visualization modes and V cycling behavior.
pom.xml Adds a debug-logging Maven profile with JFR options for javafx:run.
docs/DOCUMENTATION.md Documents Voronoi visualization and its LOD/system properties.
docs/DEVGUIDE.md Documents the new Navigation JFR event and siteCount/navId correlation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/main/java/se/hirt/diskspace/ui/render/VoronoiVisualization.java
Comment on lines +157 to +170
@Override
public void viewRootChanged(DirectoryNode previous, DirectoryNode current) {
if (previous == null || current == null || previous == current || cellHits.isEmpty()) {
lastViewRoot = null;
return;
}
animOldCells = List.copyOf(cellHits);
animNewCells = null;
animDrillNode = current;
animStartNanos = System.nanoTime();
animating = true;
animTimer.start();
lastViewRoot = null;
}
Comment on lines +606 to +610
List<TreemapItem> subItems = new ArrayList<>(children.size());
for (DirectoryNode child : children)
subItems.add(new TreemapItem(child, Math.max(1L, child.totalBytes()), false, false));
subItems = aggregateSmaller(subItems, SUB_CELL_MAX_SITES);

Comment on lines +336 to +347
private static List<Pt> cellAroundSite(List<WTriangle> tris, Site site) {
List<Pt> centers = new ArrayList<>();
for (WTriangle t : tris)
if (t.has(site))
centers.add(t.powerCenter);
if (centers.size() < 3)
return List.of();
final double sx = site.x, sy = site.y;
centers.sort(
(p1, p2) -> Double.compare(Math.atan2(p1.y() - sy, p1.x() - sx), Math.atan2(p2.y() - sy, p2.x() - sx)));
return centers;
}
Comment on lines +2368 to +2370
// Snapshot the post-paint site count once and reuse across both events so they agree even if a
// later visualization mutation changes it. Voronoi reports its aggregate-capped count; sunburst
// and heatmap default to 0 (no LOD in play — fall back to nodeCount on the analysis side).
@thegreystone
thegreystone merged commit bd4959b into main Jun 6, 2026
4 checks passed
@thegreystone
thegreystone deleted the voronoi branch June 6, 2026 01:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants