From 1e45546aedf55fd263e2afa1cea7cf1f0d1329f1 Mon Sep 17 00:00:00 2001 From: tian <11429339@qq.com> Date: Mon, 8 Jun 2026 04:20:59 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E6=9B=B4=E6=96=B0=20CHANGELOG=20?= =?UTF-8?q?=E5=92=8C=20VERSION=20=E8=87=B3=200.15.7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 12 ++++++++++ VERSION.md | 2 +- .../ObjectPassageProjectionOptimizer.cs | 24 +++++++++++++++---- 3 files changed, 32 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2be25bf..ec3d447 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ # NavisworksTransport 变更日志 +## [0.15.7] - 2026-06-08 + +### 🐛 Bug 修复 + +- **自动调整优化器改为四元数采样**: + - 网格搜索:S³ 均匀随机四元数(256 点)替代 Euler 角度网格(512 点),通过 canonical 空间桥接转换为 host Euler + - 模式搜索:7 轴 × 2 方向四元数乘法邻域搜索(`deltaQ * bestQ`),替代 Euler 角度加减 delta + - 最小步长:1° → 0.125°,提高收敛精度 + - 平局容差:1% → 0.2%,匹配高精度收敛 + - 平局规则:面积相等时优先满足门型约束(高门/宽门),约束相同时再按高度→宽度排序 + - 消除 Euler 万向节死锁和 grid 采样密度不均匀问题 + ## [0.15.6] - 2026-06-06 ### 🐛 Bug 修复 diff --git a/VERSION.md b/VERSION.md index 455e8f3..5906de7 100644 --- a/VERSION.md +++ b/VERSION.md @@ -1,3 +1,3 @@ # 版本号 -0.15.6 +0.15.7 diff --git a/src/Utils/CoordinateSystem/ObjectPassageProjectionOptimizer.cs b/src/Utils/CoordinateSystem/ObjectPassageProjectionOptimizer.cs index 5651bde..6287fa7 100644 --- a/src/Utils/CoordinateSystem/ObjectPassageProjectionOptimizer.cs +++ b/src/Utils/CoordinateSystem/ObjectPassageProjectionOptimizer.cs @@ -12,7 +12,7 @@ namespace NavisworksTransport.Utils.CoordinateSystem double sizeZ, Vector3 hostPathForward, Vector3 hostUp, - double areaRelativeTieTolerance = 0.01, + double areaRelativeTieTolerance = 0.002, Quaternion? baselineHostRotation = null) { SizeX = sizeX; @@ -164,7 +164,7 @@ namespace NavisworksTransport.Utils.CoordinateSystem foreach (var (correction, quat) in UniformQuaternionCorrections(QuaternionSampleCount, QuaternionRandomSeed)) { ObjectPassageProjectionScore score = evaluator(correction); - if (IsBetter(score, bestScore, request.AreaRelativeTieTolerance)) + if (IsBetter(score, bestScore, request.AreaRelativeTieTolerance, request.RequireWidthLarger)) { bestScore = score; bestCorrection = correction; @@ -278,7 +278,8 @@ namespace NavisworksTransport.Utils.CoordinateSystem private static bool IsBetter( ObjectPassageProjectionScore candidate, ObjectPassageProjectionScore currentBest, - double areaRelativeTieTolerance) + double areaRelativeTieTolerance, + bool? requireWidthLarger) { if (double.IsInfinity(currentBest.Area)) { @@ -293,6 +294,19 @@ namespace NavisworksTransport.Utils.CoordinateSystem if (Math.Abs(candidate.Area - currentBest.Area) <= tolerance) { + // 面积平局 → 用门型约束选择 + if (requireWidthLarger.HasValue) + { + bool candidateOk = requireWidthLarger.Value + ? candidate.WidthAcrossPath >= candidate.HeightAlongHostUp + : candidate.HeightAlongHostUp >= candidate.WidthAcrossPath; + bool currentOk = requireWidthLarger.Value + ? currentBest.WidthAcrossPath >= currentBest.HeightAlongHostUp + : currentBest.HeightAlongHostUp >= currentBest.WidthAcrossPath; + if (candidateOk && !currentOk) return true; + if (!candidateOk && currentOk) return false; + } + // 约束相同 → 选更小面积 if (candidate.HeightAlongHostUp < currentBest.HeightAlongHostUp - Epsilon) { return true; @@ -399,7 +413,7 @@ namespace NavisworksTransport.Utils.CoordinateSystem }; double stepRadians = 22.5 * Math.PI / 180.0; - while (stepRadians >= 1.0 * Math.PI / 180.0) + while (stepRadians >= 0.125 * Math.PI / 180.0) { bool improved = false; foreach (var axis in axes) @@ -411,7 +425,7 @@ namespace NavisworksTransport.Utils.CoordinateSystem var candidateQ = Quaternion.Normalize(deltaQ * bestQuaternion); var candidateEuler = CanonicalQuaternionToHostEulerCorrection(candidateQ); ObjectPassageProjectionScore score = evaluator(candidateEuler); - if (IsBetter(score, bestScore, request.AreaRelativeTieTolerance)) + if (IsBetter(score, bestScore, request.AreaRelativeTieTolerance, request.RequireWidthLarger)) { bestCorrection = candidateEuler; bestScore = score;