diff options
Diffstat (limited to 'svx/source/engine3d/obj3d.cxx')
-rw-r--r-- | svx/source/engine3d/obj3d.cxx | 154 |
1 files changed, 77 insertions, 77 deletions
diff --git a/svx/source/engine3d/obj3d.cxx b/svx/source/engine3d/obj3d.cxx index 2aed4d22e4f8..f31f110b99f2 100644 --- a/svx/source/engine3d/obj3d.cxx +++ b/svx/source/engine3d/obj3d.cxx @@ -323,48 +323,48 @@ void E3dObject::NbcResize(const Point& rRef, const Fraction& xFact, const Fracti // Movement in X, Y in the eye coordinate system E3dScene* pScene = GetScene(); - if(pScene) - { - // transform pos from 2D world to 3D eye - const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(pScene->GetViewContact()); - const drawinglayer::geometry::ViewInformation3D& aViewInfo3D(rVCScene.getViewInformation3D()); - basegfx::B2DPoint aScaleCenter2D((double)rRef.X(), (double)rRef.Y()); - basegfx::B2DHomMatrix aInverseSceneTransform(rVCScene.getObjectTransformation()); - - aInverseSceneTransform.invert(); - aScaleCenter2D = aInverseSceneTransform * aScaleCenter2D; - - basegfx::B3DPoint aScaleCenter3D(aScaleCenter2D.getX(), aScaleCenter2D.getY(), 0.5); - basegfx::B3DHomMatrix aInverseViewToEye(aViewInfo3D.getDeviceToView() * aViewInfo3D.getProjection()); - - aInverseViewToEye.invert(); - aScaleCenter3D = aInverseViewToEye * aScaleCenter3D; - - // Get scale factors - double fScaleX(xFact); - double fScaleY(yFact); - - // build transform - basegfx::B3DHomMatrix aInverseOrientation(aViewInfo3D.getOrientation()); - aInverseOrientation.invert(); - basegfx::B3DHomMatrix aFullTransform(GetFullTransform()); - basegfx::B3DHomMatrix aTrans(aFullTransform); - - aTrans *= aViewInfo3D.getOrientation(); - aTrans.translate(-aScaleCenter3D.getX(), -aScaleCenter3D.getY(), -aScaleCenter3D.getZ()); - aTrans.scale(fScaleX, fScaleY, 1.0); - aTrans.translate(aScaleCenter3D.getX(), aScaleCenter3D.getY(), aScaleCenter3D.getZ()); - aTrans *= aInverseOrientation; - aFullTransform.invert(); - aTrans *= aFullTransform; - - // Apply - basegfx::B3DHomMatrix aObjTrans(GetTransform()); - aObjTrans *= aTrans; - - E3DModifySceneSnapRectUpdater aUpdater(this); - SetTransform(aObjTrans); - } + if(!pScene) + return; + + // transform pos from 2D world to 3D eye + const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(pScene->GetViewContact()); + const drawinglayer::geometry::ViewInformation3D& aViewInfo3D(rVCScene.getViewInformation3D()); + basegfx::B2DPoint aScaleCenter2D((double)rRef.X(), (double)rRef.Y()); + basegfx::B2DHomMatrix aInverseSceneTransform(rVCScene.getObjectTransformation()); + + aInverseSceneTransform.invert(); + aScaleCenter2D = aInverseSceneTransform * aScaleCenter2D; + + basegfx::B3DPoint aScaleCenter3D(aScaleCenter2D.getX(), aScaleCenter2D.getY(), 0.5); + basegfx::B3DHomMatrix aInverseViewToEye(aViewInfo3D.getDeviceToView() * aViewInfo3D.getProjection()); + + aInverseViewToEye.invert(); + aScaleCenter3D = aInverseViewToEye * aScaleCenter3D; + + // Get scale factors + double fScaleX(xFact); + double fScaleY(yFact); + + // build transform + basegfx::B3DHomMatrix aInverseOrientation(aViewInfo3D.getOrientation()); + aInverseOrientation.invert(); + basegfx::B3DHomMatrix aFullTransform(GetFullTransform()); + basegfx::B3DHomMatrix aTrans(aFullTransform); + + aTrans *= aViewInfo3D.getOrientation(); + aTrans.translate(-aScaleCenter3D.getX(), -aScaleCenter3D.getY(), -aScaleCenter3D.getZ()); + aTrans.scale(fScaleX, fScaleY, 1.0); + aTrans.translate(aScaleCenter3D.getX(), aScaleCenter3D.getY(), aScaleCenter3D.getZ()); + aTrans *= aInverseOrientation; + aFullTransform.invert(); + aTrans *= aFullTransform; + + // Apply + basegfx::B3DHomMatrix aObjTrans(GetTransform()); + aObjTrans *= aTrans; + + E3DModifySceneSnapRectUpdater aUpdater(this); + SetTransform(aObjTrans); } @@ -375,49 +375,49 @@ void E3dObject::NbcMove(const Size& rSize) // Movement in X, Y in the eye coordinate system E3dScene* pScene = GetScene(); - if(pScene) - { - //Dimensions of the scene in 3D and 2D for comparison - tools::Rectangle aRect = pScene->GetSnapRect(); + if(!pScene) + return; - basegfx::B3DHomMatrix aInvDispTransform; - if(GetParentObj()) - { - aInvDispTransform = GetParentObj()->GetFullTransform(); - aInvDispTransform.invert(); - } + //Dimensions of the scene in 3D and 2D for comparison + tools::Rectangle aRect = pScene->GetSnapRect(); - // BoundVolume from 3d world to 3d eye - const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(pScene->GetViewContact()); - const drawinglayer::geometry::ViewInformation3D& aViewInfo3D(rVCScene.getViewInformation3D()); - basegfx::B3DRange aEyeVol(pScene->GetBoundVolume()); - aEyeVol.transform(aViewInfo3D.getOrientation()); + basegfx::B3DHomMatrix aInvDispTransform; + if(GetParentObj()) + { + aInvDispTransform = GetParentObj()->GetFullTransform(); + aInvDispTransform.invert(); + } - if ((aRect.GetWidth() == 0) || (aRect.GetHeight() == 0)) - throw o3tl::divide_by_zero(); + // BoundVolume from 3d world to 3d eye + const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(pScene->GetViewContact()); + const drawinglayer::geometry::ViewInformation3D& aViewInfo3D(rVCScene.getViewInformation3D()); + basegfx::B3DRange aEyeVol(pScene->GetBoundVolume()); + aEyeVol.transform(aViewInfo3D.getOrientation()); - // build relative movement vector in eye coordinates - basegfx::B3DPoint aMove( - (double)rSize.Width() * aEyeVol.getWidth() / (double)aRect.GetWidth(), - (double)-rSize.Height() * aEyeVol.getHeight() / (double)aRect.GetHeight(), - 0.0); - basegfx::B3DPoint aPos(0.0, 0.0, 0.0); + if ((aRect.GetWidth() == 0) || (aRect.GetHeight() == 0)) + throw o3tl::divide_by_zero(); - // movement vector to local coordinates of objects' parent - basegfx::B3DHomMatrix aInverseOrientation(aViewInfo3D.getOrientation()); - aInverseOrientation.invert(); - basegfx::B3DHomMatrix aCompleteTrans(aInvDispTransform * aInverseOrientation); + // build relative movement vector in eye coordinates + basegfx::B3DPoint aMove( + (double)rSize.Width() * aEyeVol.getWidth() / (double)aRect.GetWidth(), + (double)-rSize.Height() * aEyeVol.getHeight() / (double)aRect.GetHeight(), + 0.0); + basegfx::B3DPoint aPos(0.0, 0.0, 0.0); - aMove = aCompleteTrans * aMove; - aPos = aCompleteTrans * aPos; + // movement vector to local coordinates of objects' parent + basegfx::B3DHomMatrix aInverseOrientation(aViewInfo3D.getOrientation()); + aInverseOrientation.invert(); + basegfx::B3DHomMatrix aCompleteTrans(aInvDispTransform * aInverseOrientation); - // build transformation and apply - basegfx::B3DHomMatrix aTranslate; - aTranslate.translate(aMove.getX() - aPos.getX(), aMove.getY() - aPos.getY(), aMove.getZ() - aPos.getZ()); + aMove = aCompleteTrans * aMove; + aPos = aCompleteTrans * aPos; - E3DModifySceneSnapRectUpdater aUpdater(pScene); - SetTransform(aTranslate * GetTransform()); - } + // build transformation and apply + basegfx::B3DHomMatrix aTranslate; + aTranslate.translate(aMove.getX() - aPos.getX(), aMove.getY() - aPos.getY(), aMove.getZ() - aPos.getZ()); + + E3DModifySceneSnapRectUpdater aUpdater(pScene); + SetTransform(aTranslate * GetTransform()); } // Return the sublist, but only if it contains objects! |