1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 // MARKER(update_precomp.py): autogen include statement, do not remove 29 #include "precompiled_basegfx.hxx" 30 #include <basegfx/point/b3dpoint.hxx> 31 #include <basegfx/matrix/b3dhommatrix.hxx> 32 #include <basegfx/numeric/ftools.hxx> 33 34 namespace basegfx 35 { 36 B3DPoint& B3DPoint::operator*=( const ::basegfx::B3DHomMatrix& rMat ) 37 { 38 double fTempX( 39 rMat.get(0, 0) * mfX + 40 rMat.get(0, 1) * mfY + 41 rMat.get(0, 2) * mfZ + 42 rMat.get(0, 3)); 43 double fTempY( 44 rMat.get(1, 0) * mfX + 45 rMat.get(1, 1) * mfY + 46 rMat.get(1, 2) * mfZ + 47 rMat.get(1, 3)); 48 double fTempZ( 49 rMat.get(2, 0) * mfX + 50 rMat.get(2, 1) * mfY + 51 rMat.get(2, 2) * mfZ + 52 rMat.get(2, 3)); 53 54 if(!rMat.isLastLineDefault()) 55 { 56 const double fOne(1.0); 57 const double fTempM( 58 rMat.get(3, 0) * mfX + 59 rMat.get(3, 1) * mfY + 60 rMat.get(3, 2) * mfZ + 61 rMat.get(3, 3)); 62 63 if(!fTools::equalZero(fTempM) && !fTools::equal(fOne, fTempM)) 64 { 65 fTempX /= fTempM; 66 fTempY /= fTempM; 67 fTempZ /= fTempM; 68 } 69 } 70 71 mfX = fTempX; 72 mfY = fTempY; 73 mfZ = fTempZ; 74 75 return *this; 76 } 77 78 B3DPoint operator*( const ::basegfx::B3DHomMatrix& rMat, const B3DPoint& rPoint ) 79 { 80 B3DPoint aRes( rPoint ); 81 return aRes *= rMat; 82 } 83 } // end of namespace basegfx 84 85 // eof 86