Merge pull request '优化 transfromRegion:旋转与平移合成一次 region 变换(E3)' (#69) from home-lenovo-legion-r9000/fix-gidraw-transfromregion-e3 into main
Reviewed-on: #69 Reviewed-by: gjm <littleoldpan@163.com>
This commit was merged in pull request #69.
This commit is contained in:
commit
d329428791
1 file changed
+7
-14
@@ -223,27 +223,20 @@ AECDLLIMPEXP void GiDrawUtility::transfromRegion(AcDbRegion *pRegion
|
||||
{
|
||||
AcGePlane plan;
|
||||
plan.set(ptOnPlan, vtNormal);
|
||||
AcGePoint3d pt0, pt1, pt2;
|
||||
plan.get(pt0, pt1, pt2);
|
||||
|
||||
AcGeMatrix3d xform;
|
||||
xform.setToPlaneToWorld(plan);
|
||||
|
||||
// 把region转到此面上
|
||||
pRegion->transformBy(xform);
|
||||
|
||||
// 把 region 上的点也转到面上
|
||||
// 先把 region 上的点转到面上,求出还需要平移多少
|
||||
AcGePoint3d pt(ptOnRegion);
|
||||
pt.transformBy(xform);
|
||||
|
||||
// 再把region在面上平移
|
||||
AcGeVector3d vtm = ptOnPlan - pt;
|
||||
if (!vtm.isZeroLength())
|
||||
{
|
||||
xform.setToIdentity();
|
||||
xform.setToTranslation(ptOnPlan - pt);
|
||||
pRegion->transformBy(xform);
|
||||
}
|
||||
// 旋转与平移合成一个矩阵,region 只做一次 ACIS 变换
|
||||
AcGeMatrix3d matMove;
|
||||
matMove.setToTranslation(ptOnPlan - pt);
|
||||
xform.preMultBy(matMove);
|
||||
|
||||
pRegion->transformBy(xform);
|
||||
}
|
||||
|
||||
AECDLLIMPEXP AcGeMatrix3d GiDrawUtility::RotateAndMove(const AcGeVector3d &vtOrig
|
||||
|
||||
Reference in new issue
Block a user