fix: 自由路径'调整物体'支持角度修正和上下偏移

- MoveObjectToPathStart Free 分支:应用 _objectRotationCorrection
  (围绕物体中心旋转)后平移到起点;skipCadRestore 时修正已由调用方施加,仅平移
- 泛化 ApplyGroundPathObjectLiftOffset 支持 Free(原本仅 Ground)
- '调整物体'窗口对 Free 启用上下偏移输入
- 动画帧循环 Free 分支应用上下偏移
257 单测全过
This commit is contained in:
tian 2026-08-01 12:15:57 +08:00
parent 0390c60c36
commit 0fa9562f4b
3 changed files with 31 additions and 12 deletions

View File

@ -144,15 +144,18 @@ framePosition 即物体中心,现有碰撞盒计算直接正确(无需改动
### 6.1 "调整物体"窗口功能问题
**状态**:起点姿态、动画已正确;但"调整物体"窗口中的**各种角度调整和姿态调整功能**均存在一些问题,需逐项排查修复。
**状态**:起点姿态、动画已正确;"调整物体"窗口功能在逐步修复。
**涉及功能**(待逐项验证):
- 角度调整X/Y/Z 角度输入)
- 姿态调整(贴合地面、自动调整等)
**已修复**
- ✅ **X/Y/Z 角度调整**:根因是 `MoveObjectToPathStart` 的 Free 分支只做纯平移,
忽略了 `_objectRotationCorrection`。已改为先应用角度修正(围绕物体中心旋转)
再平移到起点;动画帧保留修正后姿态。
- ✅ **上下偏移lift**:泛化 `ApplyGroundPathObjectLiftOffset` 支持 Free
窗口对 Free 启用 lift 输入;起点和动画帧均应用偏移。
**排查方向**(明日):
1. 自由路径物体的姿态链路(宿主空间 vs 内部坐标系)
2. "调整物体"各命令在自由路径下的行为
3. 与地面/吊装/空轨路径的差异对比
**待验证**
- ☐ 自动调整ObjectPassageProjectionOptimizer
- ☐ 贴合地面FaceInfer 流程)
- ☐ 平移到起点
> 进度图例:☐ 未开始 / 🔄 进行中 / ✅ 完成

View File

@ -957,11 +957,19 @@ namespace NavisworksTransport.Core.Animation
}
else if (_route.PathType == PathType.Free)
{
// 自由路径:保持物体原始姿态,仅平移到起点(不做任何自动旋转调整)
// 自由路径:应用"调整物体"的角度修正(围绕物体中心旋转)后平移到起点,
// 无修正时保持物体原始姿态。skipCadRestore 时修正已由调用方施加,此处仅平移。
if (!_objectRotationCorrection.IsZero)
{
ApplyRotationCorrectionInPlace(_objectRotationCorrection);
SyncTrackedStateToCurrentDisplayPose();
LogManager.Debug($"[移动到起点] 自由路径已应用角度修正: {_objectRotationCorrection}");
}
startPosition = ApplyGroundPathObjectLiftOffset(startPosition);
ApplyTrackedTranslationOnly(startPosition);
SyncTrackedRotationToDisplayedPose(CurrentControlledObject ?? _animatedObject);
_hasGroundRealObjectBasePose = false;
LogManager.Debug("[移动到起点] 自由路径已保持原始姿态纯平移到起点");
LogManager.Debug("[移动到起点] 自由路径已应用姿态并平移到起点");
}
else if (_route.PathType == PathType.Ground || _route.PathType == PathType.Hoisting)
{
@ -1383,6 +1391,11 @@ namespace NavisworksTransport.Core.Animation
LogManager.Debug($"[Rail路径] 调整物体位置: 参考点=({p1.X:F2},{p1.Y:F2},{p1.Z:F2})->({p2.X:F2},{p2.Y:F2},{p2.Z:F2}), 物体中心=({framePosition.X:F2},{framePosition.Y:F2},{framePosition.Z:F2}), 安装={_route.RailMountMode}, 参考面={(PathRoute.IsTopReferenceFaceForMountMode(_route.RailMountMode) ? "" : "")}");
}
}
else if (_route.PathType == PathType.Free)
{
// 自由路径:帧位置 = 路径插值点(物体中心)+ 上下偏移
framePosition = ApplyGroundPathObjectLiftOffset(framePosition);
}
}
else
{
@ -5686,7 +5699,9 @@ namespace NavisworksTransport.Core.Animation
private Point3D ApplyGroundPathObjectLiftOffset(Point3D trackedCenter)
{
if (_route == null || _route.PathType != PathType.Ground || Math.Abs(_groundPathObjectLiftHeight) < 1e-9)
if (_route == null ||
(_route.PathType != PathType.Ground && _route.PathType != PathType.Free) ||
Math.Abs(_groundPathObjectLiftHeight) < 1e-9)
{
return trackedCenter;
}

View File

@ -2186,7 +2186,8 @@ namespace NavisworksTransport.UI.WPF.ViewModels
{
try
{
bool enableGroundLift = CurrentPathRoute?.PathType == PathType.Ground;
bool enableGroundLift = CurrentPathRoute?.PathType == PathType.Ground ||
CurrentPathRoute?.PathType == PathType.Free;
var autoAdjustmentRequest = CreateObjectPassageProjectionOptimizationRequest();
LocalEulerRotationCorrection prefillRotation = _objectRotationCorrection;
(double, double, double)? prefillAabb = null;