Skip to content

📊 Heatmap coordinate alignment issues with floor plan #8

@TangoEcho

Description

@TangoEcho

Problem

WiFi heatmap overlay was not properly aligned with the floor plan coordinate system, causing heatmap data to appear in wrong locations relative to the actual room geometry.

Root Cause

The calculateScale() and calculateOffset() methods were using incorrect coordinate calculations:

  • Used room.bounds.dimensions.x/2 and room.bounds.dimensions.z/2 for scale calculations
  • When rooms use furniture-based segmentation, all rooms share the same main surface bounds
  • This caused incorrect scaling and positioning of heatmap elements
  • WiFi measurement coordinates didn't match floor plan rendering coordinates

Impact

  • Heatmap coverage circles appeared in wrong locations
  • Signal strength visualization didn't correspond to actual measurement positions
  • Router placement recommendations were misaligned
  • Poor user experience with confusing coverage visualization

Solution Implemented

Enhanced Coordinate System:

  • Updated calculateScale() to use actual wall points from all rooms instead of surface dimensions
  • Fixed calculateOffset() to calculate center from real wall geometry
  • Added fallback logic for rooms without wall points using room centers
  • Ensured consistent coordinate transformation across floor plan and heatmap rendering

Improved Algorithm:

// Before: Used inaccurate bounds
let minX = rooms.map { $0.center.x - $0.bounds.dimensions.x/2 }.min() ?? 0

// After: Use actual wall geometry
var allWallPoints: [simd_float2] = []
for room in rooms {
    allWallPoints.append(contentsOf: room.wallPoints)
}
let minX = allWallPoints.map { $0.x }.min() ?? 0

Verification

  • Heatmap coverage circles now align with actual WiFi measurement locations
  • Router placement indicators appear at correct floor plan positions
  • Signal strength visualization matches room geometry

Files Modified

  • FloorPlanViewController.swift: Fixed coordinate calculation methods

Status: ✅ RESOLVED - Heatmap now properly aligns with floor plan using accurate coordinate system.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions