/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
B3DHomMatrix& B3DHomMatrix::operator*=(const B3DHomMatrix& rMat)
{ if(rMat.isIdentity())
{ // multiply with identity, no change -> nothing to do
} elseif(isIdentity())
{ // we are identity, result will be rMat -> assign
*this = rMat;
} else
{ // multiply
mpImpl->doMulMatrix(*rMat.mpImpl);
} return *this;
}
void B3DHomMatrix::shearXY(double fSx, double fSy)
{ // #i76239# do not test against 1.0, but against 0.0. We are talking about a value not on the diagonal (!) if(!fTools::equalZero(fSx) || !fTools::equalZero(fSy))
{
Impl3DHomMatrix aShearXYMat;
void B3DHomMatrix::shearXZ(double fSx, double fSz)
{ // #i76239# do not test against 1.0, but against 0.0. We are talking about a value not on the diagonal (!) if(!fTools::equalZero(fSx) || !fTools::equalZero(fSz))
{
Impl3DHomMatrix aShearXZMat;
// build x-axis as perpendicular from aVUV and aVPN
B3DVector aRx(aVUV.getPerpendicular(aVPN));
aRx.normalize();
// y-axis perpendicular to that
B3DVector aRy(aVPN.getPerpendicular(aRx));
aRy.normalize();
// the calculated normals are the line vectors of the rotation matrix, // set them to create rotation
aOrientationMat.set(0, 0, aRx.getX());
aOrientationMat.set(0, 1, aRx.getY());
aOrientationMat.set(0, 2, aRx.getZ());
aOrientationMat.set(1, 0, aRy.getX());
aOrientationMat.set(1, 1, aRy.getY());
aOrientationMat.set(1, 2, aRy.getZ());
aOrientationMat.set(2, 0, aVPN.getX());
aOrientationMat.set(2, 1, aVPN.getY());
aOrientationMat.set(2, 2, aVPN.getZ());
mpImpl->doMulMatrix(aOrientationMat);
}
void B3DHomMatrix::decompose(B3DTuple& rScale, B3DTuple& rTranslate, B3DTuple& rRotate, B3DTuple& rShear) const
{ // when perspective is used, decompose is not made here if(!mpImpl->isLastLineDefault()) return;
// If determinant is zero, decomposition is not possible if(determinant() == 0.0) return;
// get ScaleZ
rScale.setZ(aCol2.getLength());
aCol2.normalize();
constdouble fShearY(rShear.getY());
if(!fTools::equalZero(fShearY))
{ // coverity[copy_paste_error : FALSE] - this is correct getZ, not getY
rShear.setY(rShear.getY() / rScale.getZ());
}
constdouble fShearZ(rShear.getZ());
if(!fTools::equalZero(fShearZ))
{ // coverity[original] - this is not an original copy-and-paste source for ^^^
rShear.setZ(rShear.getZ() / rScale.getZ());
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.