From 57fedca0475ab984abcd0dcfa3d918cc3dd53055 Mon Sep 17 00:00:00 2001
From: Kurt Zenker <kz@openoffice.org>
Date: Wed, 2 Nov 2005 12:57:12 +0000
Subject: INTEGRATION: CWS canvas02 (1.5.58); FILE MERGED 2005/10/08 13:17:58
 thb 1.5.58.2: RESYNC: (1.5-1.6); FILE MERGED 2005/07/28 10:10:18 thb
 1.5.58.1: Join from cws_src680_aw024: #i48939# and new rendering subsystem
 need AW's clipper changes

---
 basegfx/source/point/b3dpoint.cxx | 53 ++++++++++++++++++++++++++++-----------
 1 file changed, 39 insertions(+), 14 deletions(-)

(limited to 'basegfx/source')

diff --git a/basegfx/source/point/b3dpoint.cxx b/basegfx/source/point/b3dpoint.cxx
index edf8a3f33029..088ecf76f545 100644
--- a/basegfx/source/point/b3dpoint.cxx
+++ b/basegfx/source/point/b3dpoint.cxx
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: b3dpoint.cxx,v $
  *
- *  $Revision: 1.6 $
+ *  $Revision: 1.7 $
  *
- *  last change: $Author: rt $ $Date: 2005-09-07 20:44:46 $
+ *  last change: $Author: kz $ $Date: 2005-11-02 13:57:12 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -41,22 +41,47 @@
 #include <basegfx/matrix/b3dhommatrix.hxx>
 #endif
 
+#ifndef _BGFX_NUMERIC_FTOOLS_HXX
+#include <basegfx/numeric/ftools.hxx>
+#endif
+
 namespace basegfx
 {
     B3DPoint& B3DPoint::operator*=( const ::basegfx::B3DHomMatrix& rMat )
     {
-        const double fTempX(rMat.get(0,0)*mfX +
-                            rMat.get(0,1)*mfY +
-                            rMat.get(0,2)*mfZ +
-                            rMat.get(0,3));
-        const double fTempY(rMat.get(1,0)*mfX +
-                            rMat.get(1,1)*mfY +
-                            rMat.get(1,2)*mfZ +
-                            rMat.get(1,3));
-        const double fTempZ(rMat.get(2,0)*mfX +
-                            rMat.get(2,1)*mfY +
-                            rMat.get(2,2)*mfZ +
-                            rMat.get(2,3));
+        double fTempX(
+            rMat.get(0, 0) * mfX +
+            rMat.get(0, 1) * mfY +
+            rMat.get(0, 2) * mfZ +
+            rMat.get(0, 3));
+        double fTempY(
+            rMat.get(1, 0) * mfX +
+            rMat.get(1, 1) * mfY +
+            rMat.get(1, 2) * mfZ +
+            rMat.get(1, 3));
+        double fTempZ(
+            rMat.get(2, 0) * mfX +
+            rMat.get(2, 1) * mfY +
+            rMat.get(2, 2) * mfZ +
+            rMat.get(2, 3));
+
+        if(!rMat.isLastLineDefault())
+        {
+            const double fOne(1.0);
+            const double fTempM(
+                rMat.get(3, 0) * mfX +
+                rMat.get(3, 1) * mfY +
+                rMat.get(3, 2) * mfZ +
+                rMat.get(3, 3));
+
+            if(!fTools::equalZero(fTempM) && !fTools::equal(fOne, fTempM))
+            {
+                fTempX /= fTempM;
+                fTempY /= fTempM;
+                fTempZ /= fTempM;
+            }
+        }
+
         mfX = fTempX;
         mfY = fTempY;
         mfZ = fTempZ;
-- 
cgit