Repository navigation
Conversation
estimate2DLine computed nx = y1 - x2 instead of y1 - y2, so the line through two sampled points was wrong unless x2 == y2. Adds a test: 10 iterations on noise-free points of a line find every point.
This was referenced Nov 14, 2026
A single call passed without the fix in about a third of the runs.
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.
Fixes #58.
LinearModelSolver<2>::estimate2DLinecomputed the normal of the line through its two sampled points as (y1 − x2, x2 − x1) instead of (y1 − y2, x2 − x1), so every 2-point line hypothesis was wrong unless x2 = y2 or x1 = x2. This PR changesx2toy2(line 175).Testing: a new test,
tests/test_line2d.py: 20 calls offindLine2D, with 10 iterations each, on 50 noise-free points of y = 2x + 1 must each return that line with every point as an inlier. It fails in 20 of 20 runs on master (a single call passes about one time in three, since the sampler is random and the local optimization sometimes repairs the line) and passes in 40 of 40 with the fix; the other tests pass (macOS, Apple clang). Independent of #52 (the null-sample crash in the same file): the two merge cleanly in either order.Updates after review: the test makes 20 calls instead of one, so that it fails on master every time (a single call passed on master in about a third of the runs).