Merge pull request '修复 RotateAndMove 平移项缺失旋转分量导致落点错位' (#64) from home-lenovo-legion-r9000/fix-gidraw-rotatemove into main

Reviewed-on: #64
Reviewed-by: gjm <littleoldpan@163.com>
This commit was merged in pull request #64.
This commit is contained in:
gjm committed 2026-10-25 18:41:51 +08:00
commit fad993af97
1 file changed
+5 -1
@@ -183,7 +183,11 @@ AECDLLIMPEXP AcGeMatrix3d GiDrawUtility::RotateAndMove(const AcGeVector3d &vtOri
AcGeMatrix3d mat(AcGeMatrix3d::kIdentity);
//mat = _vtDist.rotateTo(_vtOrig);
mat = _vtOrig.rotateTo(_vtDist);
mat.setTranslation(ptDist - ptOrig);
// 平移量须为 ptDist - R*ptOrig:先求旋转后的 ptOrig 落点,再算差值。
// 原来写成 ptDist - ptOrig,仅在 ptOrig 位于旋转轴上(含原点)时才正确。
AcGePoint3d ptTmp(ptOrig);
ptTmp.transformBy(mat);
mat.setTranslation(ptDist - ptTmp);
return mat;
}