fix: Calibration Points Not Rendering for Low Point Counts (< 4)#111
Open
thechillbasu wants to merge 1 commit intoruxailab:mainfrom
Open
fix: Calibration Points Not Rendering for Low Point Counts (< 4)#111thechillbasu wants to merge 1 commit intoruxailab:mainfrom
thechillbasu wants to merge 1 commit intoruxailab:mainfrom
Conversation
Replaces buggy generateRuntimePattern with generateCalibrationPattern to
fix an issue where setting point count to 2 or 3 resulted in infinite/NaN
coordinates due to (rows-1) division by zero.
Generated patterns now correctly handle all point counts (2-9) with
specific geometric layouts.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The eye-tracking calibration system was failing to render calibration points when configured with fewer than 4 points (e.g., 2 or 3 points).
Technical Analysis:
The bug was traced to the
generateRuntimePatternmethod used to calculate dynamic point coordinates. The logic attempts to distribute points evenly by calculating step sizes based on grid dimensions:For configurations with fewer than 4 points, the grid logic results in a single row (
rows = 1). This causes the denominator (rows - 1) to become0, leading to a Division by Zero error.The resulting coordinates become
NaN(Not a Number). Since the rendering engine cannot draw elements at invalid coordinates, the calibration screen remains blank, even though the application state indicates calibration is active.Solution and Reasoning
I replaced the usage of the flawed
generateRuntimePatternwith the existing, robustgenerateCalibrationPatternmethod.Why this is the correct fix:
Instead of patching the faulty logic in
generateRuntimePattern, switching togenerateCalibrationPatternleverages a proven implementation that explicitly handles edge cases for 1-row or 1-column layouts. It correctly calculates coordinates for any number of points without division errors, ensuring stability and preventing similar regressions.Before and After
Before (Bug)
The calibration screen remains blank with 2 points configured.
before-fix-points.mov
After (Fix)
The calibration points appear correctly and function as expected.
after-fix.points.mov
Closes #110