diff --git a/include/dock_pattern_detector/dock_profile.h b/include/dock_pattern_detector/dock_profile.h index 0d6cce7..e51c014 100644 --- a/include/dock_pattern_detector/dock_profile.h +++ b/include/dock_pattern_detector/dock_profile.h @@ -165,6 +165,10 @@ struct Detection /// Số ứng viên vượt hết mọi cổng. > 1 nghĩa là trong tầm có nhiều hình giống nhau. std::size_t candidate_count = 0; + /// Số đoạn thẳng trích được từ scan. Nhiều bất thường = cảnh đang bị vụn, chỉnh trích đoạn; + /// ít quá = đứng sai chỗ hoặc mục tiêu ngoài tầm. Hai ca khác hẳn nhau. + std::size_t segment_count = 0; + /// Vì sao không nhận, khi `valid == false`. Một câu người đọc hiểu được, không phải mã lỗi. std::string reason; }; diff --git a/src/v_pattern_matcher.cpp b/src/v_pattern_matcher.cpp index 8383618..575e472 100644 --- a/src/v_pattern_matcher.cpp +++ b/src/v_pattern_matcher.cpp @@ -339,6 +339,7 @@ Detection VPatternMatcher::match(const std::vector& lines) const } best.candidate_count = accepted; + best.segment_count = lines.size(); if (!best.valid) { @@ -411,6 +412,11 @@ Detection VPatternMatcher::match(const std::vector& 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;