Report how many segments the scan produced when a match is refused

A run reported "10 pair(s) of lines cross but do not end at the crossing" over
and over. Ten pairs implies five segments, which is a very different scene from
two, and the message did not say which. A scan fragmenting into a dozen short
pieces and a scan holding only the two far walls print the same line today, yet
they need opposite adjustments: min_split_dist and min_line_length for the
first, a different place to stand for the second.

Every refusal now ends with the segment count, and Detection carries it so a
caller can act on it rather than parse a string.
This commit is contained in:
duongtd
2026-08-26 15:41:56 +07:00
parent cea149cae9
commit 5e39ca2639
2 changed files with 10 additions and 0 deletions

View File

@@ -339,6 +339,7 @@ Detection VPatternMatcher::match(const std::vector<Line>& lines) const
}
best.candidate_count = accepted;
best.segment_count = lines.size();
if (!best.valid)
{
@@ -411,6 +412,11 @@ Detection VPatternMatcher::match(const std::vector<Line>& lines) const
{
best.reason = "no pair of segments forms a vertex";
}
// Số ĐOẠN của chính scan đó. Thiếu nó thì "cảnh vụn thành 12 mẩu" và "chỉ thấy đúng hai bức
// tường" in ra cùng một dòng, mà hai ca ấy đòi chỉnh hai khoá khác nhau: `min_split_dist` /
// `min_line_length` cho ca đầu, chỗ đứng cho ca sau.
best.reason += " [" + std::to_string(lines.size()) + " segment(s) in the scan]";
}
return best;