mesh2plan

3D Mesh → Floor Plan Research
Comprehensive research into converting 3D mesh data into 2D floor plans. From interactive Three.js viewers (v1-v9) to advanced Python analysis pipelines (v10-v16).

Interactive Viewers (v1-v9)

v1
Basic Mesh + Planes
Load OBJ mesh with MTL textures, display with plane overlays from JSON. Basic visualization with opacity controls.
Three.js • OBJ/MTL ⭐⭐⭐⭐⭐⭐
v2
Enhanced Visualization
Improved UI, better plane rendering, enhanced controls. More polished visualization with better performance.
Three.js • WebGL ⭐⭐⭐⭐⭐⭐⭐
v3
Advanced Plane Analysis
Enhanced plane detection, improved boundary rendering, better classification of wall/floor/ceiling elements.
Three.js • Geometry ⭐⭐⭐⭐⭐⭐⭐
v4
Performance Optimized
Optimized rendering pipeline, improved memory usage, better handling of large meshes and complex geometries.
Three.js • Optimization ⭐⭐⭐⭐⭐⭐⭐
v5
Interactive Floor Plans
2D floor plan generation, interactive editing, measurement tools. Bridge between 3D mesh and 2D plans.
Three.js • Canvas2D ⭐⭐⭐⭐⭐⭐⭐
v6
Wall Detection
Advanced wall detection algorithms, opening identification, architectural element classification.
Three.js • ML ⭐⭐⭐⭐⭐⭐⭐
v7
Room Segmentation
Automatic room detection, space classification, connectivity analysis. Multi-room floor plan generation.
Three.js • Clustering ⭐⭐⭐⭐⭐⭐⭐⭐
v8
Export & Integration
SVG/PDF export, CAD integration, measurement accuracy improvements. Professional output formats.
Three.js • SVG ⭐⭐⭐⭐⭐⭐⭐⭐
v9
Real-Time Browser
Real-time processing in browser, drag-drop mesh loading, side-by-side 3D/2D views, complete pipeline.
Three.js • WebWorkers ⭐⭐⭐⭐⭐⭐⭐⭐

Research Approaches (v10-v16)

v10
Voxelization + 2D Projection
Convert mesh to voxel grid, project to 2D, use morphological operations for wall cleanup. Robust and consistent results.
Python • OpenCV • Voxels ⭐⭐⭐⭐⭐⭐⭐
v11
Normal-based Wall Segmentation
Classify faces by normal direction, extract walls, use clustering and convex hull. Excellent performance on complex meshes.
Python • NumPy • DBSCAN ⭐⭐⭐⭐⭐⭐⭐⭐
v12
Contour Detection on Depth Maps
Render to height map, use edge detection and contours for walls. Good opening detection with computer vision.
Python • OpenCV • Canny ⭐⭐⭐⭐⭐⭐
v13
Alpha Shape Boundary Extraction
Extract floor points, use alpha shapes for non-convex boundaries. Sophisticated geometric approach.
Python • Alpha Shapes • Geometry ⭐⭐⭐⭐⭐⭐⭐
v14
Hybrid (v11 Walls + v12 Openings)
Combines v11's wall segmentation with v12's opening detection. Best of both worlds approach.
Python • Hybrid • Combined ⭐⭐⭐⭐⭐⭐⭐
v15
Flood-fill Room Segmentation
Voxelize and flood-fill from center to find connected rooms. Excellent room segmentation capabilities.
Python • Flood-fill • Voxels ⭐⭐⭐⭐⭐⭐⭐
v16
Confidence-Map Guided Extraction
Uses ARKit confidence maps and camera motion quality for guided extraction. Advanced AR-based approach.
Python • ARKit • Confidence ⭐⭐⭐⭐⭐⭐

L-Shape Research (v17-v21)

v17
Wall Intersection + Density Grid
First L-shape attempt. Vertex density grid confirms room footprint, builds rectilinear polygon from wall positions. Still keeps interior wall. 11.0m²
Python • Density Grid • L-Shape ⭐⭐⭐⭐⭐⭐
v18
Density Contour (Morphological)
Pure CV approach: density grid → morphological ops → contour tracing → rectilinear simplification. No wall histogram needed. Jagged output (14 walls). 11.3m²
Python • OpenCV • Morphology ⭐⭐⭐⭐⭐⭐
v19 ⭐
Smart Boundary Selection
Best result. Structural wall filtering: outermost 2 per axis, reject ALL interior X-walls. Partial Z-walls detect L-shape steps. Clean 6-vertex polygon. 10.3m² (target: 10.4m²)
Python • Structural Filtering • ⭐ Best ⭐⭐⭐⭐⭐⭐⭐⭐
v20
Hough Line Transform
Canny edge detection → HoughLinesP → cluster → boundary selection. Edges clearly show L-shape but clustering missed the step wall. 9.7m²
Python • OpenCV • Hough ⭐⭐⭐⭐⭐⭐⭐
v21
Raycasting from Centroid
Density mask → 720 rays from centroid → find room boundary → simplify to rectilinear. Room mask correct but polygon simplification broken. 3.0m²
Python • Raycasting • Experimental ⭐⭐⭐⭐⭐

Improved Variants (v20b-v21b)

v20b
Hough Improved
Lowered Hough thresholds + v19's structural wall selection. Now detects L-shape step wall. 5 walls, 3 doors, 1 window. 9.5m²
Python • Hough + Structural ⭐⭐⭐⭐⭐⭐⭐
v21b ⭐
Contour Extraction (Improved Raycast)
Threshold=1 + morphological close + fill holes → contour extraction → D-P simplification. Clean 6-vertex L-shape. 10.4m² — EXACT MATCH!
Python • Contour • ⭐ Exact Match ⭐⭐⭐⭐⭐⭐⭐⭐⭐
v22 ⭐
Hybrid (Mask + Hough Walls)
Combines v21b mask for shape + v20b Hough for square wall positions. Best of both worlds. 10.7m²
Python • Hybrid • Square Walls ⭐⭐⭐⭐⭐

Advanced Research (v23-v26)

v23
Signed Distance Field (SDF)
KDTree-based SDF from projected vertices. Multi-threshold contour extraction for optimal area. Captures room shape but overestimates due to vertex spread. 12.5m²
Python • KDTree • SDF • Contour ⭐⭐⭐⭐⭐⭐
v24
Occupancy Grid + Graph Cut
Density-based occupancy grid with iterative morphological boundary refinement using rectilinear structural elements. Undershoots area. 5.7m²
Python • Morphology • ICM ⭐⭐⭐⭐⭐
v25
Structured Edge Detection
Fuses Sobel, Laplacian, and morphological gradient edges. NMS + Hough wall extraction + structural polygon. Clean 6-vertex L-shape. 11.8m²
Python • Multi-Edge • NMS • Hough ⭐⭐⭐⭐⭐⭐⭐
v26
Poisson-style Surface Slice
Delaunay triangulation + alpha filtering for concave hull boundary. Multi-alpha search for optimal room outline. 11.2m²
Python • Delaunay • Alpha Shape ⭐⭐⭐⭐⭐⭐

Multiroom Research (v27+)

v27
MULTIROOM
Multiroom Floor Plan Detection
First multiroom approach. Room mask + interior wall classification + connected component splitting. Per-room polygon extraction with wall snapping. Door detection at wall gaps.
Edge + Hough + Mask Split → 16 rooms detected
v27e
NEW
Density-Based Room Detection
Walls = high density, rooms = low density gaps. Threshold + directional morphological closing + connected components. No Hough lines needed.
Density Gaps → 5 rooms (multiroom), 1 room (single)
v27f
NEW
Watershed Room Segmentation
OpenCV watershed on density image. Wall ridges as barriers, distance-transform room centers as seeds. Handles irregular room shapes naturally.
Watershed → 6 rooms (multiroom), 2 rooms (single)
v27g
NEW
Watershed + Distance Transform + Hallway Detection
Distance transform seeds + watershed + skeleton-based hallway carving. Correctly identifies 3 rooms + 1 hallway. Polygon extraction with wall snapping.
Watershed+Skeleton → 3R+1H (multiroom), 1R (single)
v28
MULTIROOM
Wall Grid Cell Classification
Grid cells between Hough walls, classify by interior occupancy. Problem: too many walls → tiny cells, too few → everything merges.
Wall Grid → 1 room (too coarse grid)
v28b
MULTIROOM
Edge-Based Wall Detection
Density ratio between adjacent cells detects walls. Union-find merging. Better separation but rooms have gaps between them.
Edge Graph → 4R+2H (NMS=0.3)
v29
⭐ BEST MULTIROOM
Mask Cut — Wall Scoring
Fill apartment mask, cut along strongest validated walls. Wall scoring = strength × max_run. Boundary exclusion, min separation, fragment merging.
Mask Cut → 4R+1H (12.3, 9.8, 5.3, 4.4m² + 6.1m² hall)
v30
MULTIROOM
Architectural Floor Plan
v29 detection + clean architectural rendering. Thick wall rectangles, door arcs, scale bar, pastel room fills, room classification.
Architectural → 4R+1H, 37.9m² total
v32
⭐⭐ BEST MULTIROOM
Strip Merge
X cuts → vertical strips (left/center/right). Center strip = hallway. Z cuts split strips into rooms. Door detection via mask adjacency. Matches target layout!
Strip merge → 3R+1H+1C, 34.7m² total