diff --git a/.gitignore b/.gitignore index 03001c0..f5e8f95 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,7 @@ .claude nul build -Algo/DetectHole/Export/ +Algo/DetectHole/Export +Algo/DetectBarIntersection/build +Algo/DetectBarIntersection/data +Algo/DetectBarIntersection/Export \ No newline at end of file diff --git a/Algo/DetectHole/include/HoleDetectionParams.h b/Algo/DetectHole/include/HoleDetectionParams.h index 2ad406a..1e7d536 100644 --- a/Algo/DetectHole/include/HoleDetectionParams.h +++ b/Algo/DetectHole/include/HoleDetectionParams.h @@ -16,6 +16,8 @@ struct RansacPlaneSegmentationParams { float minPlaneRatio; // 平面最小点数占比 (相对最大平面), 建议 0.05-0.2 float maxNormalAngleDeg; // 平面法向量与Z轴最大夹角 (度), 超过则直接丢弃; <=0 表示不过滤 + float maxDistFromPlane; // 点到平面的最大允许距离;超出则从 pointIndices 中移除;<=0 表示不过滤 + RansacPlaneSegmentationParams() : distanceThreshold(0.5f) , maxIterations(500) @@ -24,6 +26,7 @@ struct RansacPlaneSegmentationParams { , growthZThreshold(1.0f) , minPlaneRatio(0.1f) , maxNormalAngleDeg(30.0f) + , maxDistFromPlane(1.f) { } }; diff --git a/Algo/DetectHole/src/HoleDetection.cpp b/Algo/DetectHole/src/HoleDetection.cpp index a067ee3..08464d8 100644 --- a/Algo/DetectHole/src/HoleDetection.cpp +++ b/Algo/DetectHole/src/HoleDetection.cpp @@ -12,7 +12,7 @@ namespace { const static char* g_algo_name = "DetectHole"; - const static char* g_algo_ver = "1.0.2"; + const static char* g_algo_ver = "1.0.3"; void PrintHoleResult(const SHoleResult& hole, int index) { @@ -196,6 +196,7 @@ int DetectMultipleHoles( // ============ Step 2: 法向量过滤 ============ NormalFilterParams normalParams; + normalParams.maxDistFromPlane = ransacParams.maxDistFromPlane; FilterPlanesByNormal(planes, normalParams, points, totalPointCount); // 如果没有找到有效平面,回退到处理整个点云 diff --git a/Algo/DetectHole/src/PlaneSegmentation.h b/Algo/DetectHole/src/PlaneSegmentation.h index b4d4bd2..7725df7 100644 --- a/Algo/DetectHole/src/PlaneSegmentation.h +++ b/Algo/DetectHole/src/PlaneSegmentation.h @@ -298,7 +298,7 @@ struct NormalFilterParams { , refNx(0.0f) , refNy(0.0f) , refNz(1.0f) - , maxDistFromPlane(2.0f) + , maxDistFromPlane(0.0f) {} };