Backed out changeset 8e36dfa4061e (bug 1351426)
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Mon, 10 Apr 2017 15:15:24 +0200
changeset 560201 e27bd932966daccb4f76649c46c5fee3c72db99d
parent 560200 3cc843a5c109ec66fffb9cc71678c519edfb8c6d
child 560202 1b0e449993d4bc7391cdd2c39452ed0834cdfa24
push id53365
push userjichen@mozilla.com
push dateTue, 11 Apr 2017 08:35:12 +0000
bugs1351426
milestone55.0a1
backs out8e36dfa4061ed197cc373dc2a3f8e0da1ce06f9b
Backed out changeset 8e36dfa4061e (bug 1351426)
gfx/2d/Polygon.h
gfx/tests/gtest/PolygonTestUtils.cpp
gfx/tests/gtest/TestBSPTree.cpp
gfx/tests/gtest/TestPolygon.cpp
--- a/gfx/2d/Polygon.h
+++ b/gfx/2d/Polygon.h
@@ -72,32 +72,42 @@ ToPoints4D(const nsTArray<Point3DTyped<U
 template<class Units>
 class PolygonTyped {
   typedef Point3DTyped<Units> Point3DType;
   typedef Point4DTyped<Units> Point4DType;
 
 public:
   PolygonTyped() {}
 
+  explicit PolygonTyped(const std::initializer_list<Point3DType>& aPoints)
+    : mNormal(DefaultNormal()),
+      mPoints(ToPoints4D(nsTArray<Point3DType>(aPoints)))
+  {
+#ifdef DEBUG
+    EnsurePlanarPolygon();
+#endif
+  }
+
+  explicit PolygonTyped(const nsTArray<Point3DType>& aPoints)
+    : mNormal(DefaultNormal()), mPoints(ToPoints4D(aPoints))
+  {
+#ifdef DEBUG
+    EnsurePlanarPolygon();
+#endif
+  }
+
   explicit PolygonTyped(const nsTArray<Point4DType>& aPoints,
-                        const Point4DType& aNormal = DefaultNormal())
-    : mNormal(aNormal), mPoints(aPoints) {}
+                          const Point4DType& aNormal = DefaultNormal())
+    : mNormal(aNormal), mPoints(aPoints)
+  {}
 
   explicit PolygonTyped(nsTArray<Point4DType>&& aPoints,
-                        const Point4DType& aNormal = DefaultNormal())
-    : mNormal(aNormal), mPoints(Move(aPoints)) {}
-
-  explicit PolygonTyped(const std::initializer_list<Point4DType>& aPoints,
-                        const Point4DType& aNormal = DefaultNormal())
-    : mNormal(aNormal), mPoints(aPoints)
-  {
-    #ifdef DEBUG
-    EnsurePlanarPolygon();
-    #endif
-  }
+                          const Point4DType& aNormal = DefaultNormal())
+    : mNormal(aNormal), mPoints(Move(aPoints))
+  {}
 
   RectTyped<Units> BoundingBox() const
   {
     if (mPoints.IsEmpty()) {
       return RectTyped<Units>();
     }
 
     float minX, maxX, minY, maxY;
@@ -184,24 +194,22 @@ public:
       }
     }
 
     return polygon;
   }
 
   static PolygonTyped<Units> FromRect(const RectTyped<Units>& aRect)
   {
-    nsTArray<Point4DType> points {
-      Point4DType(aRect.x, aRect.y, 0.0f, 1.0f),
-      Point4DType(aRect.x, aRect.YMost(), 0.0f, 1.0f),
-      Point4DType(aRect.XMost(), aRect.YMost(), 0.0f, 1.0f),
-      Point4DType(aRect.XMost(), aRect.y, 0.0f, 1.0f)
+    return PolygonTyped<Units> {
+      Point3DType(aRect.x, aRect.y, 0.0f),
+      Point3DType(aRect.x, aRect.y + aRect.height, 0.0f),
+      Point3DType(aRect.x + aRect.width, aRect.y + aRect.height, 0.0f),
+      Point3DType(aRect.x + aRect.width, aRect.y, 0.0f)
     };
-
-    return PolygonTyped<Units>(Move(points));
   }
 
   const Point4DType& GetNormal() const
   {
     return mNormal;
   }
 
   const nsTArray<Point4DType>& GetPoints() const
--- a/gfx/tests/gtest/PolygonTestUtils.cpp
+++ b/gfx/tests/gtest/PolygonTestUtils.cpp
@@ -91,58 +91,58 @@ bool operator==(const MozPolygon& lhs, c
 }
 
 } // namespace gfx
 } // namespace mozilla
 
 
 TEST(PolygonTestUtils, TestSanity)
 {
-  EXPECT_TRUE(FuzzyEquals(Point4D(0.0f, 0.0f, 0.0f, 1.0f),
-                          Point4D(0.0f, 0.0f, 0.0f, 1.0f)));
+  EXPECT_TRUE(FuzzyEquals(Point3D(0.0f, 0.0f, 0.0f),
+                          Point3D(0.0f, 0.0f, 0.0f)));
 
-  EXPECT_TRUE(FuzzyEquals(Point4D(0.0f, 0.0f, 0.0f, 1.0f),
-                          Point4D(0.00001f, 0.00001f, 0.00001f, 1.0f)));
+  EXPECT_TRUE(FuzzyEquals(Point3D(0.0f, 0.0f, 0.0f),
+                          Point3D(0.00001f, 0.00001f, 0.00001f)));
 
-  EXPECT_TRUE(FuzzyEquals(Point4D(0.00001f, 0.00001f, 0.00001f, 1.0f),
-                          Point4D(0.0f, 0.0f, 0.0f, 1.0f)));
+  EXPECT_TRUE(FuzzyEquals(Point3D(0.00001f, 0.00001f, 0.00001f),
+                          Point3D(0.0f, 0.0f, 0.0f)));
 
-  EXPECT_FALSE(FuzzyEquals(Point4D(0.0f, 0.0f, 0.0f, 1.0f),
-                           Point4D(0.01f, 0.01f, 0.01f, 1.0f)));
+  EXPECT_FALSE(FuzzyEquals(Point3D(0.0f, 0.0f, 0.0f),
+                           Point3D(0.01f, 0.01f, 0.01f)));
 
-  EXPECT_FALSE(FuzzyEquals(Point4D(0.01f, 0.01f, 0.01f, 1.0f),
-                           Point4D(0.0f, 0.0f, 0.0f, 1.0f)));
+  EXPECT_FALSE(FuzzyEquals(Point3D(0.01f, 0.01f, 0.01f),
+                           Point3D(0.0f, 0.0f, 0.0f)));
 
   MozPolygon p1 {
-    Point4D(0.0f, 0.0f, 1.0f, 1.0f),
-    Point4D(1.0f, 0.0f, 1.0f, 1.0f),
-    Point4D(1.0f, 1.0f, 1.0f, 1.0f),
-    Point4D(0.0f, 1.0f, 1.0f, 1.0f)
+    Point3D(0.0f, 0.0f, 1.0f),
+    Point3D(1.0f, 0.0f, 1.0f),
+    Point3D(1.0f, 1.0f, 1.0f),
+    Point3D(0.0f, 1.0f, 1.0f)
   };
 
   // Same points as above shifted forward by one position.
   MozPolygon shifted {
-    Point4D(0.0f, 1.0f, 1.0f, 1.0f),
-    Point4D(0.0f, 0.0f, 1.0f, 1.0f),
-    Point4D(1.0f, 0.0f, 1.0f, 1.0f),
-    Point4D(1.0f, 1.0f, 1.0f, 1.0f)
+    Point3D(0.0f, 1.0f, 1.0f),
+    Point3D(0.0f, 0.0f, 1.0f),
+    Point3D(1.0f, 0.0f, 1.0f),
+    Point3D(1.0f, 1.0f, 1.0f)
   };
 
   MozPolygon p2 {
-    Point4D(0.00001f, 0.00001f, 1.00001f, 1.0f),
-    Point4D(1.00001f, 0.00001f, 1.00001f, 1.0f),
-    Point4D(1.00001f, 1.00001f, 1.00001f, 1.0f),
-    Point4D(0.00001f, 1.00001f, 1.00001f, 1.0f)
+    Point3D(0.00001f, 0.00001f, 1.00001f),
+    Point3D(1.00001f, 0.00001f, 1.00001f),
+    Point3D(1.00001f, 1.00001f, 1.00001f),
+    Point3D(0.00001f, 1.00001f, 1.00001f)
   };
 
   MozPolygon p3 {
-    Point4D(0.01f, 0.01f, 1.01f, 1.0f),
-    Point4D(1.01f, 0.01f, 1.01f, 1.0f),
-    Point4D(1.01f, 1.01f, 1.01f, 1.0f),
-    Point4D(0.01f, 1.01f, 1.01f, 1.0f)
+    Point3D(0.01f, 0.01f, 1.01f),
+    Point3D(1.01f, 0.01f, 1.01f),
+    Point3D(1.01f, 1.01f, 1.01f),
+    Point3D(0.01f, 1.01f, 1.01f)
   };
 
   // Trivial equals
   EXPECT_TRUE(p1 == p1);
   EXPECT_TRUE(p2 == p2);
   EXPECT_TRUE(p3 == p3);
   EXPECT_TRUE(shifted == shifted);
 
--- a/gfx/tests/gtest/TestBSPTree.cpp
+++ b/gfx/tests/gtest/TestBSPTree.cpp
@@ -5,17 +5,16 @@
 
 #include "gtest/gtest.h"
 
 #include "BSPTree.h"
 #include "Polygon.h"
 #include "PolygonTestUtils.h"
 
 #include <deque>
-#include <list>
 
 using namespace mozilla::gfx;
 using namespace mozilla::layers;
 typedef mozilla::gfx::Polygon MozPolygon;
 
 namespace {
 
 static void RunTest(std::deque<MozPolygon> aPolygons,
@@ -38,924 +37,924 @@ static void RunTest(std::deque<MozPolygo
 
 } // namespace
 
 
 TEST(BSPTree, SameNode)
 {
   const std::deque<MozPolygon> polygons {
     MozPolygon {
-      Point4D(0.0f, 0.0f, 0.0f, 1.0f),
-      Point4D(1.0f, 0.0f, 0.0f, 1.0f),
-      Point4D(1.0f, 1.0f, 0.0f, 1.0f),
-      Point4D(0.0f, 1.0f, 0.0f, 1.0f)
+      Point3D(0.0f, 0.0f, 0.0f),
+      Point3D(1.0f, 0.0f, 0.0f),
+      Point3D(1.0f, 1.0f, 0.0f),
+      Point3D(0.0f, 1.0f, 0.0f)
     },
     MozPolygon {
-      Point4D(0.0f, 0.0f, 0.0f, 1.0f),
-      Point4D(1.0f, 0.0f, 0.0f, 1.0f),
-      Point4D(1.0f, 1.0f, 0.0f, 1.0f),
-      Point4D(0.0f, 1.0f, 0.0f, 1.0f)
+      Point3D(0.0f, 0.0f, 0.0f),
+      Point3D(1.0f, 0.0f, 0.0f),
+      Point3D(1.0f, 1.0f, 0.0f),
+      Point3D(0.0f, 1.0f, 0.0f)
     }
   };
 
   ::RunTest(polygons, polygons);
 }
 
 TEST(BSPTree, OneChild)
 {
   const MozPolygon p1 {
-    Point4D(0.0f, 0.0f, 0.0f, 1.0f),
-    Point4D(1.0f, 0.0f, 0.0f, 1.0f),
-    Point4D(1.0f, 1.0f, 0.0f, 1.0f),
-    Point4D(0.0f, 1.0f, 0.0f, 1.0f)
+    Point3D(0.0f, 0.0f, 0.0f),
+    Point3D(1.0f, 0.0f, 0.0f),
+    Point3D(1.0f, 1.0f, 0.0f),
+    Point3D(0.0f, 1.0f, 0.0f)
   };
 
   const MozPolygon p2 {
-    Point4D(0.0f, 0.0f, 1.0f, 1.0f),
-    Point4D(1.0f, 0.0f, 1.0f, 1.0f),
-    Point4D(1.0f, 1.0f, 1.0f, 1.0f),
-    Point4D(0.0f, 1.0f, 1.0f, 1.0f)
+    Point3D(0.0f, 0.0f, 1.0f),
+    Point3D(1.0f, 0.0f, 1.0f),
+    Point3D(1.0f, 1.0f, 1.0f),
+    Point3D(0.0f, 1.0f, 1.0f)
   };
 
   ::RunTest({p1, p2}, {p1, p2});
   ::RunTest({p2, p1}, {p1, p2});
 }
 
 TEST(BSPTree, SharedEdge1)
 {
   MozPolygon p1 {
-    Point4D(1.0f, 0.0f, 1.0f, 1.0f),
-    Point4D(0.0f, 0.0f, 1.0f, 1.0f),
-    Point4D(0.0f, 1.0f, 1.0f, 1.0f),
-    Point4D(1.0f, 1.0f, 1.0f, 1.0f)
+    Point3D(1.0f, 0.0f, 1.0f),
+    Point3D(0.0f, 0.0f, 1.0f),
+    Point3D(0.0f, 1.0f, 1.0f),
+    Point3D(1.0f, 1.0f, 1.0f)
   };
 
   MozPolygon p2 {
-    Point4D(1.0f, 0.0f, 1.0f, 1.0f),
-    Point4D(1.0f, 1.0f, 1.0f, 1.0f),
-    Point4D(2.0f, 2.0f, 1.0f, 1.0f),
-    Point4D(2.0f, 0.0f, 1.0f, 1.0f)
+    Point3D(1.0f, 0.0f, 1.0f),
+    Point3D(1.0f, 1.0f, 1.0f),
+    Point3D(2.0f, 2.0f, 1.0f),
+    Point3D(2.0f, 0.0f, 1.0f)
   };
 
   ::RunTest({p1, p2}, {p1, p2});
 }
 
 TEST(BSPTree, SharedEdge2)
 {
   MozPolygon p1 {
-    Point4D(1.0f, 0.0f, 1.0f, 1.0f),
-    Point4D(0.0f, 0.0f, 1.0f, 1.0f),
-    Point4D(0.0f, 1.0f, 1.0f, 1.0f),
-    Point4D(1.0f, 1.0f, 1.0f, 1.0f)
+    Point3D(1.0f, 0.0f, 1.0f),
+    Point3D(0.0f, 0.0f, 1.0f),
+    Point3D(0.0f, 1.0f, 1.0f),
+    Point3D(1.0f, 1.0f, 1.0f)
   };
 
   MozPolygon p2 {
-    Point4D(1.0f, 0.0f, 1.0f, 1.0f),
-    Point4D(1.0f, 1.0f, 1.0f, 1.0f),
-    Point4D(2.0f, 2.0f, 0.0f, 1.0f),
-    Point4D(2.0f, 0.0f, 0.0f, 1.0f)
+    Point3D(1.0f, 0.0f, 1.0f),
+    Point3D(1.0f, 1.0f, 1.0f),
+    Point3D(2.0f, 2.0f, 0.0f),
+    Point3D(2.0f, 0.0f, 0.0f)
   };
 
   ::RunTest({p1, p2}, {p2, p1});
 }
 
 TEST(BSPTree, SplitSharedEdge)
 {
   MozPolygon p1 {
-    Point4D(1.0f, 0.0f, 1.0f, 1.0f),
-    Point4D(0.0f, 0.0f, 1.0f, 1.0f),
-    Point4D(0.0f, 1.0f, 1.0f, 1.0f),
-    Point4D(1.0f, 1.0f, 1.0f, 1.0f)
+    Point3D(1.0f, 0.0f, 1.0f),
+    Point3D(0.0f, 0.0f, 1.0f),
+    Point3D(0.0f, 1.0f, 1.0f),
+    Point3D(1.0f, 1.0f, 1.0f)
   };
 
   MozPolygon p2 {
-    Point4D(1.0f, 0.0f, 2.0f, 1.0f),
-    Point4D(1.0f, 1.0f, 2.0f, 1.0f),
-    Point4D(1.0f, 1.0f, 0.0f, 1.0f),
-    Point4D(1.0f, 0.0f, 0.0f, 1.0f)
+    Point3D(1.0f, 0.0f, 2.0f),
+    Point3D(1.0f, 1.0f, 2.0f),
+    Point3D(1.0f, 1.0f, 0.0f),
+    Point3D(1.0f, 0.0f, 0.0f)
   };
 
   const std::deque<MozPolygon> expected {
     MozPolygon {
-      Point4D(1.0f, 1.0f, 1.0f, 1.0f),
-      Point4D(1.0f, 1.0f, 0.0f, 1.0f),
-      Point4D(1.0f, 0.0f, 0.0f, 1.0f),
-      Point4D(1.0f, 0.0f, 1.0f, 1.0f)
+      Point3D(1.0f, 1.0f, 1.0f),
+      Point3D(1.0f, 1.0f, 0.0f),
+      Point3D(1.0f, 0.0f, 0.0f),
+      Point3D(1.0f, 0.0f, 1.0f)
     },
     MozPolygon {
-      Point4D(1.0f, 0.0f, 1.0f, 1.0f),
-      Point4D(0.0f, 0.0f, 1.0f, 1.0f),
-      Point4D(0.0f, 1.0f, 1.0f, 1.0f),
-      Point4D(1.0f, 1.0f, 1.0f, 1.0f)
+      Point3D(1.0f, 0.0f, 1.0f),
+      Point3D(0.0f, 0.0f, 1.0f),
+      Point3D(0.0f, 1.0f, 1.0f),
+      Point3D(1.0f, 1.0f, 1.0f)
     },
     MozPolygon {
-      Point4D(1.0f, 0.0f, 2.0f, 1.0f),
-      Point4D(1.0f, 1.0f, 2.0f, 1.0f),
-      Point4D(1.0f, 1.0f, 1.0f, 1.0f),
-      Point4D(1.0f, 0.0f, 1.0f, 1.0f)
+      Point3D(1.0f, 0.0f, 2.0f),
+      Point3D(1.0f, 1.0f, 2.0f),
+      Point3D(1.0f, 1.0f, 1.0f),
+      Point3D(1.0f, 0.0f, 1.0f)
     }
   };
 
   ::RunTest({p1, p2}, expected);
 }
 
 TEST(BSPTree, SplitSimple1)
 {
   MozPolygon p1 {
-    Point4D(0.0f, 0.0f, 1.0f, 1.0f),
-    Point4D(1.0f, 0.0f, 1.0f, 1.0f),
-    Point4D(1.0f, 1.0f, 1.0f, 1.0f),
-    Point4D(0.0f, 1.0f, 1.0f, 1.0f)
+    Point3D(0.0f, 0.0f, 1.0f),
+    Point3D(1.0f, 0.0f, 1.0f),
+    Point3D(1.0f, 1.0f, 1.0f),
+    Point3D(0.0f, 1.0f, 1.0f)
   };
 
   MozPolygon p2 {
-    Point4D(0.0f, 0.0f, 2.0f, 1.0f),
-    Point4D(1.0f, 0.0f, 2.0f, 1.0f),
-    Point4D(1.0f, 1.0f, 0.0f, 1.0f),
-    Point4D(0.0f, 1.0f, 0.0f, 1.0f)
+    Point3D(0.0f, 0.0f, 2.0f),
+    Point3D(1.0f, 0.0f, 2.0f),
+    Point3D(1.0f, 1.0f, 0.0f),
+    Point3D(0.0f, 1.0f, 0.0f)
   };
 
   const std::deque<MozPolygon> expected {
     MozPolygon {
-      Point4D(0.0f, 1.0f, 0.0f, 1.0f),
-      Point4D(0.0f, 0.5f, 1.0f, 1.0f),
-      Point4D(1.0f, 0.5f, 1.0f, 1.0f),
-      Point4D(1.0f, 1.0f, 0.0f, 1.0f)
+      Point3D(0.0f, 1.0f, 0.0f),
+      Point3D(0.0f, 0.5f, 1.0f),
+      Point3D(1.0f, 0.5f, 1.0f),
+      Point3D(1.0f, 1.0f, 0.0f)
     },
     p1,
     MozPolygon {
-      Point4D(0.0f, 0.0f, 2.0f, 1.0f),
-      Point4D(1.0f, 0.0f, 2.0f, 1.0f),
-      Point4D(1.0f, 0.5f, 1.0f, 1.0f),
-      Point4D(0.0f, 0.5f, 1.0f, 1.0f)
+      Point3D(0.0f, 0.0f, 2.0f),
+      Point3D(1.0f, 0.0f, 2.0f),
+      Point3D(1.0f, 0.5f, 1.0f),
+      Point3D(0.0f, 0.5f, 1.0f)
     }
   };
 
   ::RunTest({p1, p2}, expected);
 }
 
 TEST(BSPTree, SplitSimple2) {
   const std::deque<MozPolygon> polygons {
     MozPolygon {
-      Point4D(-5.00000f, -5.00000f, 0.00000f, 1.0f),
-      Point4D(-5.00000f, 5.00000f, 0.00000f, 1.0f),
-      Point4D(5.00000f, 5.00000f, 0.00000f, 1.0f),
-      Point4D(5.00000f, -5.00000f, 0.00000f, 1.0f)
+      Point3D(-5.00000f, -5.00000f, 0.00000f),
+      Point3D(-5.00000f, 5.00000f, 0.00000f),
+      Point3D(5.00000f, 5.00000f, 0.00000f),
+      Point3D(5.00000f, -5.00000f, 0.00000f)
     },
     MozPolygon {
-      Point4D(0.00000f, -5.00000f, -5.00000f, 1.0f),
-      Point4D(0.00000f, 5.00000f, -5.00000f, 1.0f),
-      Point4D(0.00000f, 5.00000f, 5.00000f, 1.0f),
-      Point4D(0.00000f, -5.00000f, 5.00000f, 1.0f)
+      Point3D(0.00000f, -5.00000f, -5.00000f),
+      Point3D(0.00000f, 5.00000f, -5.00000f),
+      Point3D(0.00000f, 5.00000f, 5.00000f),
+      Point3D(0.00000f, -5.00000f, 5.00000f)
     }
   };
 
   const std::deque<MozPolygon> expected {
     MozPolygon {
-      Point4D(0.00000f, -5.00000f, 0.00000f, 1.0f),
-      Point4D(0.00000f, -5.00000f, -5.00000f, 1.0f),
-      Point4D(0.00000f, 5.00000f, -5.00000f, 1.0f),
-      Point4D(0.00000f, 5.00000f, 0.00000f, 1.0f)
+      Point3D(0.00000f, -5.00000f, 0.00000f),
+      Point3D(0.00000f, -5.00000f, -5.00000f),
+      Point3D(0.00000f, 5.00000f, -5.00000f),
+      Point3D(0.00000f, 5.00000f, 0.00000f)
     },
     MozPolygon {
-      Point4D(-5.00000f, -5.00000f, 0.00000f, 1.0f),
-      Point4D(-5.00000f, 5.00000f, 0.00000f, 1.0f),
-      Point4D(5.00000f, 5.00000f, 0.00000f, 1.0f),
-      Point4D(5.00000f, -5.00000f, 0.00000f, 1.0f)
+      Point3D(-5.00000f, -5.00000f, 0.00000f),
+      Point3D(-5.00000f, 5.00000f, 0.00000f),
+      Point3D(5.00000f, 5.00000f, 0.00000f),
+      Point3D(5.00000f, -5.00000f, 0.00000f)
     },
     MozPolygon {
-      Point4D(0.00000f, 5.00000f, 0.00000f, 1.0f),
-      Point4D(0.00000f, 5.00000f, 5.00000f, 1.0f),
-      Point4D(0.00000f, -5.00000f, 5.00000f, 1.0f),
-      Point4D(0.00000f, -5.00000f, 0.00000f, 1.0f)
+      Point3D(0.00000f, 5.00000f, 0.00000f),
+      Point3D(0.00000f, 5.00000f, 5.00000f),
+      Point3D(0.00000f, -5.00000f, 5.00000f),
+      Point3D(0.00000f, -5.00000f, 0.00000f)
     }
   };
   ::RunTest(polygons, expected);
 }
 
 TEST(BSPTree, NoSplit1) {
   const std::deque<MozPolygon> polygons {
     MozPolygon {
-      Point4D(0.00000f, 10.00000f, 0.00000f, 1.0f),
-      Point4D(0.00000f, 0.00000f, 0.00000f, 1.0f),
-      Point4D(10.00000f, 0.00000f, 0.00000f, 1.0f),
-      Point4D(10.00000f, 10.00000f, 0.00000f, 1.0f)
+      Point3D(0.00000f, 10.00000f, 0.00000f),
+      Point3D(0.00000f, 0.00000f, 0.00000f),
+      Point3D(10.00000f, 0.00000f, 0.00000f),
+      Point3D(10.00000f, 10.00000f, 0.00000f)
     },
     MozPolygon {
-      Point4D(0.00000f, 10.00000f, -5.00000f, 1.0f),
-      Point4D(0.00000f, 0.00000f, -5.00000f, 1.0f),
-      Point4D(10.00000f, 0.00000f, -5.00000f, 1.0f),
-      Point4D(10.00000f, 10.00000f, -5.00000f, 1.0f)
+      Point3D(0.00000f, 10.00000f, -5.00000f),
+      Point3D(0.00000f, 0.00000f, -5.00000f),
+      Point3D(10.00000f, 0.00000f, -5.00000f),
+      Point3D(10.00000f, 10.00000f, -5.00000f)
     },
     MozPolygon {
-      Point4D(0.00000f, 10.00000f, 5.00000f, 1.0f),
-      Point4D(0.00000f, 0.00000f, 5.00000f, 1.0f),
-      Point4D(10.00000f, 0.00000f, 5.00000f, 1.0f),
-      Point4D(10.00000f, 10.00000f, 5.00000f, 1.0f)
+      Point3D(0.00000f, 10.00000f, 5.00000f),
+      Point3D(0.00000f, 0.00000f, 5.00000f),
+      Point3D(10.00000f, 0.00000f, 5.00000f),
+      Point3D(10.00000f, 10.00000f, 5.00000f)
     }
   };
 
   const std::deque<MozPolygon> expected {
     MozPolygon {
-      Point4D(0.00000f, 10.00000f, -5.00000f, 1.0f),
-      Point4D(0.00000f, 0.00000f, -5.00000f, 1.0f),
-      Point4D(10.00000f, 0.00000f, -5.00000f, 1.0f),
-      Point4D(10.00000f, 10.00000f, -5.00000f, 1.0f)
+      Point3D(0.00000f, 10.00000f, -5.00000f),
+      Point3D(0.00000f, 0.00000f, -5.00000f),
+      Point3D(10.00000f, 0.00000f, -5.00000f),
+      Point3D(10.00000f, 10.00000f, -5.00000f)
     },
     MozPolygon {
-      Point4D(0.00000f, 10.00000f, 0.00000f, 1.0f),
-      Point4D(0.00000f, 0.00000f, 0.00000f, 1.0f),
-      Point4D(10.00000f, 0.00000f, 0.00000f, 1.0f),
-      Point4D(10.00000f, 10.00000f, 0.00000f, 1.0f)
+      Point3D(0.00000f, 10.00000f, 0.00000f),
+      Point3D(0.00000f, 0.00000f, 0.00000f),
+      Point3D(10.00000f, 0.00000f, 0.00000f),
+      Point3D(10.00000f, 10.00000f, 0.00000f)
     },
     MozPolygon {
-      Point4D(0.00000f, 10.00000f, 5.00000f, 1.0f),
-      Point4D(0.00000f, 0.00000f, 5.00000f, 1.0f),
-      Point4D(10.00000f, 0.00000f, 5.00000f, 1.0f),
-      Point4D(10.00000f, 10.00000f, 5.00000f, 1.0f)
+      Point3D(0.00000f, 10.00000f, 5.00000f),
+      Point3D(0.00000f, 0.00000f, 5.00000f),
+      Point3D(10.00000f, 0.00000f, 5.00000f),
+      Point3D(10.00000f, 10.00000f, 5.00000f)
     }
   };
   ::RunTest(polygons, expected);
 }
 
 TEST(BSPTree, NoSplit2) {
   const std::deque<MozPolygon> polygons {
     MozPolygon {
-      Point4D(-5.00000f, -5.00000f, 0.00000f, 1.0f),
-      Point4D(-5.00000f, 5.00000f, 0.00000f, 1.0f),
-      Point4D(5.00000f, 5.00000f, 0.00000f, 1.0f),
-      Point4D(5.00000f, -5.00000f, 0.00000f, 1.0f)
+      Point3D(-5.00000f, -5.00000f, 0.00000f),
+      Point3D(-5.00000f, 5.00000f, 0.00000f),
+      Point3D(5.00000f, 5.00000f, 0.00000f),
+      Point3D(5.00000f, -5.00000f, 0.00000f)
     },
     MozPolygon {
-      Point4D(0.00000f, 5.00000f, -15.00000f, 1.0f),
-      Point4D(0.00000f, -5.00000f, -15.00000f, 1.0f),
-      Point4D(0.00000f, -5.00000f, -10.00000f, 1.0f),
-      Point4D(0.00000f, 5.00000f, -10.00000f, 1.0f)
+      Point3D(0.00000f, 5.00000f, -15.00000f),
+      Point3D(0.00000f, -5.00000f, -15.00000f),
+      Point3D(0.00000f, -5.00000f, -10.00000f),
+      Point3D(0.00000f, 5.00000f, -10.00000f)
     }
   };
 
   const std::deque<MozPolygon> expected {
     MozPolygon {
-      Point4D(0.00000f, 5.00000f, -15.00000f, 1.0f),
-      Point4D(0.00000f, -5.00000f, -15.00000f, 1.0f),
-      Point4D(0.00000f, -5.00000f, -10.00000f, 1.0f),
-      Point4D(0.00000f, 5.00000f, -10.00000f, 1.0f)
+      Point3D(0.00000f, 5.00000f, -15.00000f),
+      Point3D(0.00000f, -5.00000f, -15.00000f),
+      Point3D(0.00000f, -5.00000f, -10.00000f),
+      Point3D(0.00000f, 5.00000f, -10.00000f)
     },
     MozPolygon {
-      Point4D(-5.00000f, -5.00000f, 0.00000f, 1.0f),
-      Point4D(-5.00000f, 5.00000f, 0.00000f, 1.0f),
-      Point4D(5.00000f, 5.00000f, 0.00000f, 1.0f),
-      Point4D(5.00000f, -5.00000f, 0.00000f, 1.0f)
+      Point3D(-5.00000f, -5.00000f, 0.00000f),
+      Point3D(-5.00000f, 5.00000f, 0.00000f),
+      Point3D(5.00000f, 5.00000f, 0.00000f),
+      Point3D(5.00000f, -5.00000f, 0.00000f)
     }
   };
   ::RunTest(polygons, expected);
 }
 
 TEST(BSPTree, TwoPlaneIntersectRotate0degrees) {
   const std::deque<MozPolygon> polygons {
     MozPolygon {
-      Point4D(-0.00000f, 2.00000f, 2.00000f, 1.0f),
-      Point4D(-0.00000f, -2.00000f, 2.00000f, 1.0f),
-      Point4D(0.00010f, -2.00000f, -2.00000f, 1.0f),
-      Point4D(0.00010f, 2.00000f, -2.00000f, 1.0f)
+      Point3D(-0.00000f, 2.00000f, 2.00000f),
+      Point3D(-0.00000f, -2.00000f, 2.00000f),
+      Point3D(0.00010f, -2.00000f, -2.00000f),
+      Point3D(0.00010f, 2.00000f, -2.00000f)
     },
     MozPolygon {
-      Point4D(2.00000f, 0.00000f, 2.00000f, 1.0f),
-      Point4D(2.00000f, -0.00000f, -2.00000f, 1.0f),
-      Point4D(-2.00000f, 0.00000f, -2.00000f, 1.0f),
-      Point4D(-2.00000f, 0.00010f, 2.00000f, 1.0f)
+      Point3D(2.00000f, 0.00000f, 2.00000f),
+      Point3D(2.00000f, -0.00000f, -2.00000f),
+      Point3D(-2.00000f, 0.00000f, -2.00000f),
+      Point3D(-2.00000f, 0.00010f, 2.00000f)
     }
   };
 
   const std::deque<MozPolygon> expected {
     MozPolygon {
-      Point4D(2.00000f, 0.00000f, 2.00000f, 1.0f),
-      Point4D(2.00000f, -0.00000f, -2.00000f, 1.0f),
-      Point4D(-2.00000f, 0.00000f, -2.00000f, 1.0f),
-      Point4D(-2.00000f, 0.00010f, 2.00000f, 1.0f)
+      Point3D(2.00000f, 0.00000f, 2.00000f),
+      Point3D(2.00000f, -0.00000f, -2.00000f),
+      Point3D(-2.00000f, 0.00000f, -2.00000f),
+      Point3D(-2.00000f, 0.00010f, 2.00000f)
     },
     MozPolygon {
-      Point4D(-0.00000f, 2.00000f, 2.00000f, 1.0f),
-      Point4D(-0.00000f, -2.00000f, 2.00000f, 1.0f),
-      Point4D(0.00010f, -2.00000f, -2.00000f, 1.0f),
-      Point4D(0.00010f, 2.00000f, -2.00000f, 1.0f)
+      Point3D(-0.00000f, 2.00000f, 2.00000f),
+      Point3D(-0.00000f, -2.00000f, 2.00000f),
+      Point3D(0.00010f, -2.00000f, -2.00000f),
+      Point3D(0.00010f, 2.00000f, -2.00000f)
     }
   };
   ::RunTest(polygons, expected);
 }
 
 TEST(BSPTree, TwoPlaneIntersectRotate20degrees) {
   const std::deque<MozPolygon> polygons {
     MozPolygon {
-      Point4D(-0.00000f, 1.19540f, 2.56350f, 1.0f),
-      Point4D(-0.00000f, -2.56340f, 1.19540f, 1.0f),
-      Point4D(0.00010f, -1.19530f, -2.56340f, 1.0f),
-      Point4D(0.00010f, 2.56350f, -1.19530f, 1.0f)
+      Point3D(-0.00000f, 1.19540f, 2.56350f),
+      Point3D(-0.00000f, -2.56340f, 1.19540f),
+      Point3D(0.00010f, -1.19530f, -2.56340f),
+      Point3D(0.00010f, 2.56350f, -1.19530f)
     },
     MozPolygon {
-      Point4D(2.00000f, -0.68400f, 1.87940f, 1.0f),
-      Point4D(2.00000f, 0.68410f, -1.87930f, 1.0f),
-      Point4D(-2.00000f, 0.68410f, -1.87930f, 1.0f),
-      Point4D(-2.00000f, -0.68400f, 1.87940f, 1.0f)
+      Point3D(2.00000f, -0.68400f, 1.87940f),
+      Point3D(2.00000f, 0.68410f, -1.87930f),
+      Point3D(-2.00000f, 0.68410f, -1.87930f),
+      Point3D(-2.00000f, -0.68400f, 1.87940f)
     }
   };
 
   const std::deque<MozPolygon> expected {
     MozPolygon {
-      Point4D(2.00000f, -0.68400f, 1.87940f, 1.0f),
-      Point4D(2.00000f, 0.68410f, -1.87930f, 1.0f),
-      Point4D(-2.00000f, 0.68410f, -1.87930f, 1.0f),
-      Point4D(-2.00000f, -0.68400f, 1.87940f, 1.0f)
+      Point3D(2.00000f, -0.68400f, 1.87940f),
+      Point3D(2.00000f, 0.68410f, -1.87930f),
+      Point3D(-2.00000f, 0.68410f, -1.87930f),
+      Point3D(-2.00000f, -0.68400f, 1.87940f)
     },
     MozPolygon {
-      Point4D(-0.00000f, 1.19540f, 2.56350f, 1.0f),
-      Point4D(-0.00000f, -2.56340f, 1.19540f, 1.0f),
-      Point4D(0.00010f, -1.19530f, -2.56340f, 1.0f),
-      Point4D(0.00010f, 2.56350f, -1.19530f, 1.0f)
+      Point3D(-0.00000f, 1.19540f, 2.56350f),
+      Point3D(-0.00000f, -2.56340f, 1.19540f),
+      Point3D(0.00010f, -1.19530f, -2.56340f),
+      Point3D(0.00010f, 2.56350f, -1.19530f)
     }
   };
   ::RunTest(polygons, expected);
 }
 
 TEST(BSPTree, TwoPlaneIntersectRotate40degrees) {
   const std::deque<MozPolygon> polygons {
     MozPolygon {
-      Point4D(-0.00000f, -0.73200f, 2.73210f, 1.0f),
-      Point4D(-0.00000f, -2.73200f, -0.73200f, 1.0f),
-      Point4D(0.00010f, 0.73210f, -2.73200f, 1.0f),
-      Point4D(0.00010f, 2.73210f, 0.73210f, 1.0f)
+      Point3D(-0.00000f, -0.73200f, 2.73210f),
+      Point3D(-0.00000f, -2.73200f, -0.73200f),
+      Point3D(0.00010f, 0.73210f, -2.73200f),
+      Point3D(0.00010f, 2.73210f, 0.73210f)
     },
     MozPolygon {
-      Point4D(2.00000f, -1.73200f, 1.00000f, 1.0f),
-      Point4D(2.00000f, 1.73210f, -0.99990f, 1.0f),
-      Point4D(-2.00000f, 1.73210f, -0.99990f, 1.0f),
-      Point4D(-2.00000f, -1.73200f, 1.00000f, 1.0f)
+      Point3D(2.00000f, -1.73200f, 1.00000f),
+      Point3D(2.00000f, 1.73210f, -0.99990f),
+      Point3D(-2.00000f, 1.73210f, -0.99990f),
+      Point3D(-2.00000f, -1.73200f, 1.00000f)
     }
   };
 
   const std::deque<MozPolygon> expected {
     MozPolygon {
-      Point4D(2.00000f, -1.73200f, 1.00000f, 1.0f),
-      Point4D(2.00000f, 1.73210f, -0.99990f, 1.0f),
-      Point4D(-2.00000f, 1.73210f, -0.99990f, 1.0f),
-      Point4D(-2.00000f, -1.73200f, 1.00000f, 1.0f)
+      Point3D(2.00000f, -1.73200f, 1.00000f),
+      Point3D(2.00000f, 1.73210f, -0.99990f),
+      Point3D(-2.00000f, 1.73210f, -0.99990f),
+      Point3D(-2.00000f, -1.73200f, 1.00000f)
     },
     MozPolygon {
-      Point4D(-0.00000f, -0.73200f, 2.73210f, 1.0f),
-      Point4D(-0.00000f, -2.73200f, -0.73200f, 1.0f),
-      Point4D(0.00010f, 0.73210f, -2.73200f, 1.0f),
-      Point4D(0.00010f, 2.73210f, 0.73210f, 1.0f)
+      Point3D(-0.00000f, -0.73200f, 2.73210f),
+      Point3D(-0.00000f, -2.73200f, -0.73200f),
+      Point3D(0.00010f, 0.73210f, -2.73200f),
+      Point3D(0.00010f, 2.73210f, 0.73210f)
     }
   };
   ::RunTest(polygons, expected);
 }
 
 TEST(BSPTree, TwoPlaneIntersectRotate60degrees) {
   const std::deque<MozPolygon> polygons {
     MozPolygon {
-      Point4D(-0.00000f, -2.73200f, 0.73210f, 1.0f),
-      Point4D(-0.00000f, -0.73200f, -2.73200f, 1.0f),
-      Point4D(0.00010f, 2.73210f, -0.73200f, 1.0f),
-      Point4D(0.00010f, 0.73210f, 2.73210f, 1.0f)
+      Point3D(-0.00000f, -2.73200f, 0.73210f),
+      Point3D(-0.00000f, -0.73200f, -2.73200f),
+      Point3D(0.00010f, 2.73210f, -0.73200f),
+      Point3D(0.00010f, 0.73210f, 2.73210f)
     },
     MozPolygon {
-      Point4D(2.00000f, -1.73200f, -1.00000f, 1.0f),
-      Point4D(2.00000f, 1.73210f, 1.00010f, 1.0f),
-      Point4D(-2.00000f, 1.73210f, 1.00010f, 1.0f),
-      Point4D(-2.00000f, -1.73200f, -1.00000f, 1.0f)
+      Point3D(2.00000f, -1.73200f, -1.00000f),
+      Point3D(2.00000f, 1.73210f, 1.00010f),
+      Point3D(-2.00000f, 1.73210f, 1.00010f),
+      Point3D(-2.00000f, -1.73200f, -1.00000f)
     }
   };
 
   const std::deque<MozPolygon> expected {
     MozPolygon {
-      Point4D(-2.00000f, 1.26793f, 0.73210f, 1.0f),
-      Point4D(-2.00000f, -1.73200f, -1.00000f, 1.0f),
-      Point4D(2.00000f, -1.73200f, -1.00000f, 1.0f),
-      Point4D(2.00000f, 1.26793f, 0.73210f, 1.0f)
+      Point3D(-2.00000f, 1.26793f, 0.73210f),
+      Point3D(-2.00000f, -1.73200f, -1.00000f),
+      Point3D(2.00000f, -1.73200f, -1.00000f),
+      Point3D(2.00000f, 1.26793f, 0.73210f)
     },
     MozPolygon {
-      Point4D(-0.00000f, -2.73200f, 0.73210f, 1.0f),
-      Point4D(-0.00000f, -0.73200f, -2.73200f, 1.0f),
-      Point4D(0.00010f, 2.73210f, -0.73200f, 1.0f),
-      Point4D(0.00010f, 0.73210f, 2.73210f, 1.0f)
+      Point3D(-0.00000f, -2.73200f, 0.73210f),
+      Point3D(-0.00000f, -0.73200f, -2.73200f),
+      Point3D(0.00010f, 2.73210f, -0.73200f),
+      Point3D(0.00010f, 0.73210f, 2.73210f)
     },
     MozPolygon {
-      Point4D(2.00000f, 1.26793f, 0.73210f, 1.0f),
-      Point4D(2.00000f, 1.73210f, 1.00010f, 1.0f),
-      Point4D(-2.00000f, 1.73210f, 1.00010f, 1.0f),
-      Point4D(-2.00000f, 1.26793f, 0.73210f, 1.0f)
+      Point3D(2.00000f, 1.26793f, 0.73210f),
+      Point3D(2.00000f, 1.73210f, 1.00010f),
+      Point3D(-2.00000f, 1.73210f, 1.00010f),
+      Point3D(-2.00000f, 1.26793f, 0.73210f)
     }
   };
   ::RunTest(polygons, expected);
 }
 
 TEST(BSPTree, TwoPlaneIntersectRotate80degrees) {
   const std::deque<MozPolygon> polygons {
     MozPolygon {
-      Point4D(-0.00000f, -1.19530f, -2.56340f, 1.0f),
-      Point4D(-0.00000f, 2.56350f, -1.19530f, 1.0f),
-      Point4D(0.00010f, 1.19540f, 2.56350f, 1.0f),
-      Point4D(0.00010f, -2.56340f, 1.19540f, 1.0f)
+      Point3D(-0.00000f, -1.19530f, -2.56340f),
+      Point3D(-0.00000f, 2.56350f, -1.19530f),
+      Point3D(0.00010f, 1.19540f, 2.56350f),
+      Point3D(0.00010f, -2.56340f, 1.19540f)
     },
     MozPolygon {
-      Point4D(2.00000f, 0.68410f, -1.87930f, 1.0f),
-      Point4D(2.00000f, -0.68400f, 1.87940f, 1.0f),
-      Point4D(-2.00000f, -0.68400f, 1.87940f, 1.0f),
-      Point4D(-2.00000f, 0.68410f, -1.87930f, 1.0f)
+      Point3D(2.00000f, 0.68410f, -1.87930f),
+      Point3D(2.00000f, -0.68400f, 1.87940f),
+      Point3D(-2.00000f, -0.68400f, 1.87940f),
+      Point3D(-2.00000f, 0.68410f, -1.87930f)
     }
   };
 
   const std::deque<MozPolygon> expected {
     MozPolygon {
-      Point4D(-0.00000f, -1.19530f, -2.56340f, 1.0f),
-      Point4D(-0.00000f, 2.56350f, -1.19530f, 1.0f),
-      Point4D(0.00010f, 1.19540f, 2.56350f, 1.0f),
-      Point4D(0.00010f, -2.56340f, 1.19540f, 1.0f)
+      Point3D(-0.00000f, -1.19530f, -2.56340f),
+      Point3D(-0.00000f, 2.56350f, -1.19530f),
+      Point3D(0.00010f, 1.19540f, 2.56350f),
+      Point3D(0.00010f, -2.56340f, 1.19540f)
     },
     MozPolygon {
-      Point4D(2.00000f, 0.68410f, -1.87930f, 1.0f),
-      Point4D(2.00000f, -0.68400f, 1.87940f, 1.0f),
-      Point4D(-2.00000f, -0.68400f, 1.87940f, 1.0f),
-      Point4D(-2.00000f, 0.68410f, -1.87930f, 1.0f)
+      Point3D(2.00000f, 0.68410f, -1.87930f),
+      Point3D(2.00000f, -0.68400f, 1.87940f),
+      Point3D(-2.00000f, -0.68400f, 1.87940f),
+      Point3D(-2.00000f, 0.68410f, -1.87930f)
     }
   };
   ::RunTest(polygons, expected);
 }
 
 TEST(BSPTree, TwoPlaneIntersectRotate100degrees) {
   const std::deque<MozPolygon> polygons {
     MozPolygon {
-      Point4D(-0.00000f, 2.73210f, -0.73200f, 1.0f),
-      Point4D(-0.00000f, 0.73210f, 2.73210f, 1.0f),
-      Point4D(0.00010f, -2.73200f, 0.73210f, 1.0f),
-      Point4D(0.00010f, -0.73200f, -2.73200f, 1.0f)
+      Point3D(-0.00000f, 2.73210f, -0.73200f),
+      Point3D(-0.00000f, 0.73210f, 2.73210f),
+      Point3D(0.00010f, -2.73200f, 0.73210f),
+      Point3D(0.00010f, -0.73200f, -2.73200f)
     },
     MozPolygon {
-      Point4D(2.00000f, 1.73210f, 1.00010f, 1.0f),
-      Point4D(2.00000f, -1.73200f, -1.00000f, 1.0f),
-      Point4D(-2.00000f, -1.73200f, -1.00000f, 1.0f),
-      Point4D(-2.00000f, 1.73210f, 1.00010f, 1.0f)
+      Point3D(2.00000f, 1.73210f, 1.00010f),
+      Point3D(2.00000f, -1.73200f, -1.00000f),
+      Point3D(-2.00000f, -1.73200f, -1.00000f),
+      Point3D(-2.00000f, 1.73210f, 1.00010f)
     }
   };
 
   const std::deque<MozPolygon> expected {
     MozPolygon {
-      Point4D(2.00000f, -1.26783f, -0.73200f, 1.0f),
-      Point4D(2.00000f, -1.73200f, -1.00000f, 1.0f),
-      Point4D(-2.00000f, -1.73200f, -1.00000f, 1.0f),
-      Point4D(-2.00000f, -1.26783f, -0.73200f, 1.0f)
+      Point3D(2.00000f, -1.26783f, -0.73200f),
+      Point3D(2.00000f, -1.73200f, -1.00000f),
+      Point3D(-2.00000f, -1.73200f, -1.00000f),
+      Point3D(-2.00000f, -1.26783f, -0.73200f)
     },
     MozPolygon {
-      Point4D(-0.00000f, 2.73210f, -0.73200f, 1.0f),
-      Point4D(-0.00000f, 0.73210f, 2.73210f, 1.0f),
-      Point4D(0.00010f, -2.73200f, 0.73210f, 1.0f),
-      Point4D(0.00010f, -0.73200f, -2.73200f, 1.0f)
+      Point3D(-0.00000f, 2.73210f, -0.73200f),
+      Point3D(-0.00000f, 0.73210f, 2.73210f),
+      Point3D(0.00010f, -2.73200f, 0.73210f),
+      Point3D(0.00010f, -0.73200f, -2.73200f)
     },
     MozPolygon {
-      Point4D(-2.00000f, -1.26783f, -0.73200f, 1.0f),
-      Point4D(-2.00000f, 1.73210f, 1.00010f, 1.0f),
-      Point4D(2.00000f, 1.73210f, 1.00010f, 1.0f),
-      Point4D(2.00000f, -1.26783f, -0.73200f, 1.0f)
+      Point3D(-2.00000f, -1.26783f, -0.73200f),
+      Point3D(-2.00000f, 1.73210f, 1.00010f),
+      Point3D(2.00000f, 1.73210f, 1.00010f),
+      Point3D(2.00000f, -1.26783f, -0.73200f)
     }
   };
   ::RunTest(polygons, expected);
 }
 
 TEST(BSPTree, TwoPlaneIntersectRotate120degrees) {
   const std::deque<MozPolygon> polygons {
     MozPolygon {
-      Point4D(-0.00000f, -0.73200f, 2.73210f, 1.0f),
-      Point4D(-0.00000f, -2.73200f, -0.73200f, 1.0f),
-      Point4D(0.00010f, 0.73210f, -2.73200f, 1.0f),
-      Point4D(0.00010f, 2.73210f, 0.73210f, 1.0f)
+      Point3D(-0.00000f, -0.73200f, 2.73210f),
+      Point3D(-0.00000f, -2.73200f, -0.73200f),
+      Point3D(0.00010f, 0.73210f, -2.73200f),
+      Point3D(0.00010f, 2.73210f, 0.73210f)
     },
     MozPolygon {
-      Point4D(2.00000f, -1.73200f, 1.00000f, 1.0f),
-      Point4D(2.00000f, 1.73210f, -0.99990f, 1.0f),
-      Point4D(-2.00000f, 1.73210f, -0.99990f, 1.0f),
-      Point4D(-2.00000f, -1.73200f, 1.00000f, 1.0f)
+      Point3D(2.00000f, -1.73200f, 1.00000f),
+      Point3D(2.00000f, 1.73210f, -0.99990f),
+      Point3D(-2.00000f, 1.73210f, -0.99990f),
+      Point3D(-2.00000f, -1.73200f, 1.00000f)
     }
   };
 
   const std::deque<MozPolygon> expected {
     MozPolygon {
-      Point4D(2.00000f, -1.73200f, 1.00000f, 1.0f),
-      Point4D(2.00000f, 1.73210f, -0.99990f, 1.0f),
-      Point4D(-2.00000f, 1.73210f, -0.99990f, 1.0f),
-      Point4D(-2.00000f, -1.73200f, 1.00000f, 1.0f)
+      Point3D(2.00000f, -1.73200f, 1.00000f),
+      Point3D(2.00000f, 1.73210f, -0.99990f),
+      Point3D(-2.00000f, 1.73210f, -0.99990f),
+      Point3D(-2.00000f, -1.73200f, 1.00000f)
     },
     MozPolygon {
-      Point4D(-0.00000f, -0.73200f, 2.73210f, 1.0f),
-      Point4D(-0.00000f, -2.73200f, -0.73200f, 1.0f),
-      Point4D(0.00010f, 0.73210f, -2.73200f, 1.0f),
-      Point4D(0.00010f, 2.73210f, 0.73210f, 1.0f)
+      Point3D(-0.00000f, -0.73200f, 2.73210f),
+      Point3D(-0.00000f, -2.73200f, -0.73200f),
+      Point3D(0.00010f, 0.73210f, -2.73200f),
+      Point3D(0.00010f, 2.73210f, 0.73210f)
     }
   };
   ::RunTest(polygons, expected);
 }
 
 TEST(BSPTree, TwoPlaneIntersectRotate140degrees) {
   const std::deque<MozPolygon> polygons {
     MozPolygon {
-      Point4D(-0.00000f, -1.19530f, -2.56340f, 1.0f),
-      Point4D(-0.00000f, 2.56350f, -1.19530f, 1.0f),
-      Point4D(0.00010f, 1.19540f, 2.56350f, 1.0f),
-      Point4D(0.00010f, -2.56340f, 1.19540f, 1.0f)
+      Point3D(-0.00000f, -1.19530f, -2.56340f),
+      Point3D(-0.00000f, 2.56350f, -1.19530f),
+      Point3D(0.00010f, 1.19540f, 2.56350f),
+      Point3D(0.00010f, -2.56340f, 1.19540f)
     },
     MozPolygon {
-      Point4D(2.00000f, 0.68410f, -1.87930f, 1.0f),
-      Point4D(2.00000f, -0.68400f, 1.87940f, 1.0f),
-      Point4D(-2.00000f, -0.68400f, 1.87940f, 1.0f),
-      Point4D(-2.00000f, 0.68410f, -1.87930f, 1.0f)
+      Point3D(2.00000f, 0.68410f, -1.87930f),
+      Point3D(2.00000f, -0.68400f, 1.87940f),
+      Point3D(-2.00000f, -0.68400f, 1.87940f),
+      Point3D(-2.00000f, 0.68410f, -1.87930f)
     }
   };
 
   const std::deque<MozPolygon> expected {
     MozPolygon {
-      Point4D(-0.00000f, -1.19530f, -2.56340f, 1.0f),
-      Point4D(-0.00000f, 2.56350f, -1.19530f, 1.0f),
-      Point4D(0.00010f, 1.19540f, 2.56350f, 1.0f),
-      Point4D(0.00010f, -2.56340f, 1.19540f, 1.0f)
+      Point3D(-0.00000f, -1.19530f, -2.56340f),
+      Point3D(-0.00000f, 2.56350f, -1.19530f),
+      Point3D(0.00010f, 1.19540f, 2.56350f),
+      Point3D(0.00010f, -2.56340f, 1.19540f)
     },
     MozPolygon {
-      Point4D(2.00000f, 0.68410f, -1.87930f, 1.0f),
-      Point4D(2.00000f, -0.68400f, 1.87940f, 1.0f),
-      Point4D(-2.00000f, -0.68400f, 1.87940f, 1.0f),
-      Point4D(-2.00000f, 0.68410f, -1.87930f, 1.0f)
+      Point3D(2.00000f, 0.68410f, -1.87930f),
+      Point3D(2.00000f, -0.68400f, 1.87940f),
+      Point3D(-2.00000f, -0.68400f, 1.87940f),
+      Point3D(-2.00000f, 0.68410f, -1.87930f)
     }
   };
   ::RunTest(polygons, expected);
 }
 
 TEST(BSPTree, TwoPlaneIntersectRotate160degrees) {
   const std::deque<MozPolygon> polygons {
     MozPolygon {
-      Point4D(-0.00000f, 2.00000f, 2.00000f, 1.0f),
-      Point4D(-0.00000f, -2.00000f, 2.00000f, 1.0f),
-      Point4D(0.00010f, -2.00000f, -2.00000f, 1.0f),
-      Point4D(0.00010f, 2.00000f, -2.00000f, 1.0f)
+      Point3D(-0.00000f, 2.00000f, 2.00000f),
+      Point3D(-0.00000f, -2.00000f, 2.00000f),
+      Point3D(0.00010f, -2.00000f, -2.00000f),
+      Point3D(0.00010f, 2.00000f, -2.00000f)
     },
     MozPolygon {
-      Point4D(2.00000f, -0.00000f, 2.00000f, 1.0f),
-      Point4D(2.00000f, 0.00010f, -2.00000f, 1.0f),
-      Point4D(-2.00000f, 0.00010f, -2.00000f, 1.0f),
-      Point4D(-2.00000f, -0.00000f, 2.00000f, 1.0f)
+      Point3D(2.00000f, -0.00000f, 2.00000f),
+      Point3D(2.00000f, 0.00010f, -2.00000f),
+      Point3D(-2.00000f, 0.00010f, -2.00000f),
+      Point3D(-2.00000f, -0.00000f, 2.00000f)
     }
   };
 
   const std::deque<MozPolygon> expected {
     MozPolygon {
-      Point4D(2.00000f, -0.00000f, 2.00000f, 1.0f),
-      Point4D(2.00000f, 0.00010f, -2.00000f, 1.0f),
-      Point4D(-2.00000f, 0.00010f, -2.00000f, 1.0f),
-      Point4D(-2.00000f, -0.00000f, 2.00000f, 1.0f)
+      Point3D(2.00000f, -0.00000f, 2.00000f),
+      Point3D(2.00000f, 0.00010f, -2.00000f),
+      Point3D(-2.00000f, 0.00010f, -2.00000f),
+      Point3D(-2.00000f, -0.00000f, 2.00000f)
     },
     MozPolygon {
-      Point4D(-0.00000f, 2.00000f, 2.00000f, 1.0f),
-      Point4D(-0.00000f, -2.00000f, 2.00000f, 1.0f),
-      Point4D(0.00010f, -2.00000f, -2.00000f, 1.0f),
-      Point4D(0.00010f, 2.00000f, -2.00000f, 1.0f)
+      Point3D(-0.00000f, 2.00000f, 2.00000f),
+      Point3D(-0.00000f, -2.00000f, 2.00000f),
+      Point3D(0.00010f, -2.00000f, -2.00000f),
+      Point3D(0.00010f, 2.00000f, -2.00000f)
     }
   };
   ::RunTest(polygons, expected);
 }
 
 TEST(BSPTree, TwoPlaneIntersectRotate180degrees) {
   const std::deque<MozPolygon> polygons {
     MozPolygon {
-      Point4D(-0.00000f, -2.00000f, -2.00000f, 1.0f),
-      Point4D(-0.00000f, 2.00000f, -2.00000f, 1.0f),
-      Point4D(0.00010f, 2.00000f, 2.00000f, 1.0f),
-      Point4D(0.00010f, -2.00000f, 2.00000f, 1.0f)
+      Point3D(-0.00000f, -2.00000f, -2.00000f),
+      Point3D(-0.00000f, 2.00000f, -2.00000f),
+      Point3D(0.00010f, 2.00000f, 2.00000f),
+      Point3D(0.00010f, -2.00000f, 2.00000f)
     },
     MozPolygon {
-      Point4D(2.00000f, 0.00010f, -2.00000f, 1.0f),
-      Point4D(2.00000f, -0.00000f, 2.00000f, 1.0f),
-      Point4D(-2.00000f, -0.00000f, 2.00000f, 1.0f),
-      Point4D(-2.00000f, 0.00010f, -2.00000f, 1.0f)
+      Point3D(2.00000f, 0.00010f, -2.00000f),
+      Point3D(2.00000f, -0.00000f, 2.00000f),
+      Point3D(-2.00000f, -0.00000f, 2.00000f),
+      Point3D(-2.00000f, 0.00010f, -2.00000f)
     }
   };
 
   const std::deque<MozPolygon> expected {
     MozPolygon {
-      Point4D(-0.00000f, -2.00000f, -2.00000f, 1.0f),
-      Point4D(-0.00000f, 2.00000f, -2.00000f, 1.0f),
-      Point4D(0.00010f, 2.00000f, 2.00000f, 1.0f),
-      Point4D(0.00010f, -2.00000f, 2.00000f, 1.0f)
+      Point3D(-0.00000f, -2.00000f, -2.00000f),
+      Point3D(-0.00000f, 2.00000f, -2.00000f),
+      Point3D(0.00010f, 2.00000f, 2.00000f),
+      Point3D(0.00010f, -2.00000f, 2.00000f)
     },
     MozPolygon {
-      Point4D(2.00000f, 0.00010f, -2.00000f, 1.0f),
-      Point4D(2.00000f, -0.00000f, 2.00000f, 1.0f),
-      Point4D(-2.00000f, -0.00000f, 2.00000f, 1.0f),
-      Point4D(-2.00000f, 0.00010f, -2.00000f, 1.0f)
+      Point3D(2.00000f, 0.00010f, -2.00000f),
+      Point3D(2.00000f, -0.00000f, 2.00000f),
+      Point3D(-2.00000f, -0.00000f, 2.00000f),
+      Point3D(-2.00000f, 0.00010f, -2.00000f)
     }
   };
   ::RunTest(polygons, expected);
 }
 
 TEST(BSPTree, TwoPlaneIntersectRotate200degrees) {
   const std::deque<MozPolygon> polygons {
     MozPolygon {
-      Point4D(-0.00000f, 1.19540f, 2.56350f, 1.0f),
-      Point4D(-0.00000f, -2.56340f, 1.19540f, 1.0f),
-      Point4D(0.00010f, -1.19530f, -2.56340f, 1.0f),
-      Point4D(0.00010f, 2.56350f, -1.19530f, 1.0f)
+      Point3D(-0.00000f, 1.19540f, 2.56350f),
+      Point3D(-0.00000f, -2.56340f, 1.19540f),
+      Point3D(0.00010f, -1.19530f, -2.56340f),
+      Point3D(0.00010f, 2.56350f, -1.19530f)
     },
     MozPolygon {
-      Point4D(2.00000f, -0.68400f, 1.87940f, 1.0f),
-      Point4D(2.00000f, 0.68410f, -1.87930f, 1.0f),
-      Point4D(-2.00000f, 0.68410f, -1.87930f, 1.0f),
-      Point4D(-2.00000f, -0.68400f, 1.87940f, 1.0f)
+      Point3D(2.00000f, -0.68400f, 1.87940f),
+      Point3D(2.00000f, 0.68410f, -1.87930f),
+      Point3D(-2.00000f, 0.68410f, -1.87930f),
+      Point3D(-2.00000f, -0.68400f, 1.87940f)
     }
   };
 
   const std::deque<MozPolygon> expected {
     MozPolygon {
-      Point4D(2.00000f, -0.68400f, 1.87940f, 1.0f),
-      Point4D(2.00000f, 0.68410f, -1.87930f, 1.0f),
-      Point4D(-2.00000f, 0.68410f, -1.87930f, 1.0f),
-      Point4D(-2.00000f, -0.68400f, 1.87940f, 1.0f)
+      Point3D(2.00000f, -0.68400f, 1.87940f),
+      Point3D(2.00000f, 0.68410f, -1.87930f),
+      Point3D(-2.00000f, 0.68410f, -1.87930f),
+      Point3D(-2.00000f, -0.68400f, 1.87940f)
     },
     MozPolygon {
-      Point4D(-0.00000f, 1.19540f, 2.56350f, 1.0f),
-      Point4D(-0.00000f, -2.56340f, 1.19540f, 1.0f),
-      Point4D(0.00010f, -1.19530f, -2.56340f, 1.0f),
-      Point4D(0.00010f, 2.56350f, -1.19530f, 1.0f)
+      Point3D(-0.00000f, 1.19540f, 2.56350f),
+      Point3D(-0.00000f, -2.56340f, 1.19540f),
+      Point3D(0.00010f, -1.19530f, -2.56340f),
+      Point3D(0.00010f, 2.56350f, -1.19530f)
     }
   };
   ::RunTest(polygons, expected);
 }
 
 TEST(BSPTree, TwoPlaneIntersectRotate220degrees) {
   const std::deque<MozPolygon> polygons {
     MozPolygon {
-      Point4D(-0.00000f, 0.73210f, -2.73200f, 1.0f),
-      Point4D(-0.00000f, 2.73210f, 0.73210f, 1.0f),
-      Point4D(0.00010f, -0.73200f, 2.73210f, 1.0f),
-      Point4D(0.00010f, -2.73200f, -0.73200f, 1.0f)
+      Point3D(-0.00000f, 0.73210f, -2.73200f),
+      Point3D(-0.00000f, 2.73210f, 0.73210f),
+      Point3D(0.00010f, -0.73200f, 2.73210f),
+      Point3D(0.00010f, -2.73200f, -0.73200f)
     },
     MozPolygon {
-      Point4D(2.00000f, 1.73210f, -0.99990f, 1.0f),
-      Point4D(2.00000f, -1.73200f, 1.00000f, 1.0f),
-      Point4D(-2.00000f, -1.73200f, 1.00000f, 1.0f),
-      Point4D(-2.00000f, 1.73210f, -0.99990f, 1.0f)
+      Point3D(2.00000f, 1.73210f, -0.99990f),
+      Point3D(2.00000f, -1.73200f, 1.00000f),
+      Point3D(-2.00000f, -1.73200f, 1.00000f),
+      Point3D(-2.00000f, 1.73210f, -0.99990f)
     }
   };
 
   const std::deque<MozPolygon> expected {
     MozPolygon {
-      Point4D(-0.00000f, 0.73210f, -2.73200f, 1.0f),
-      Point4D(-0.00000f, 2.73210f, 0.73210f, 1.0f),
-      Point4D(0.00010f, -0.73200f, 2.73210f, 1.0f),
-      Point4D(0.00010f, -2.73200f, -0.73200f, 1.0f)
+      Point3D(-0.00000f, 0.73210f, -2.73200f),
+      Point3D(-0.00000f, 2.73210f, 0.73210f),
+      Point3D(0.00010f, -0.73200f, 2.73210f),
+      Point3D(0.00010f, -2.73200f, -0.73200f)
     },
     MozPolygon {
-      Point4D(2.00000f, 1.73210f, -0.99990f, 1.0f),
-      Point4D(2.00000f, -1.73200f, 1.00000f, 1.0f),
-      Point4D(-2.00000f, -1.73200f, 1.00000f, 1.0f),
-      Point4D(-2.00000f, 1.73210f, -0.99990f, 1.0f)
+      Point3D(2.00000f, 1.73210f, -0.99990f),
+      Point3D(2.00000f, -1.73200f, 1.00000f),
+      Point3D(-2.00000f, -1.73200f, 1.00000f),
+      Point3D(-2.00000f, 1.73210f, -0.99990f)
     }
   };
   ::RunTest(polygons, expected);
 }
 
 TEST(BSPTree, TwoPlaneIntersectRotate240degrees) {
   const std::deque<MozPolygon> polygons {
     MozPolygon {
-      Point4D(-0.00000f, -2.73200f, 0.73210f, 1.0f),
-      Point4D(-0.00000f, -0.73200f, -2.73200f, 1.0f),
-      Point4D(0.00010f, 2.73210f, -0.73200f, 1.0f),
-      Point4D(0.00010f, 0.73210f, 2.73210f, 1.0f)
+      Point3D(-0.00000f, -2.73200f, 0.73210f),
+      Point3D(-0.00000f, -0.73200f, -2.73200f),
+      Point3D(0.00010f, 2.73210f, -0.73200f),
+      Point3D(0.00010f, 0.73210f, 2.73210f)
     },
     MozPolygon {
-      Point4D(2.00000f, -1.73200f, -1.00000f, 1.0f),
-      Point4D(2.00000f, 1.73210f, 1.00010f, 1.0f),
-      Point4D(-2.00000f, 1.73210f, 1.00010f, 1.0f),
-      Point4D(-2.00000f, -1.73200f, -1.00000f, 1.0f)
+      Point3D(2.00000f, -1.73200f, -1.00000f),
+      Point3D(2.00000f, 1.73210f, 1.00010f),
+      Point3D(-2.00000f, 1.73210f, 1.00010f),
+      Point3D(-2.00000f, -1.73200f, -1.00000f)
     }
   };
 
   const std::deque<MozPolygon> expected {
     MozPolygon {
-      Point4D(-2.00000f, 1.26793f, 0.73210f, 1.0f),
-      Point4D(-2.00000f, -1.73200f, -1.00000f, 1.0f),
-      Point4D(2.00000f, -1.73200f, -1.00000f, 1.0f),
-      Point4D(2.00000f, 1.26793f, 0.73210f, 1.0f)
+      Point3D(-2.00000f, 1.26793f, 0.73210f),
+      Point3D(-2.00000f, -1.73200f, -1.00000f),
+      Point3D(2.00000f, -1.73200f, -1.00000f),
+      Point3D(2.00000f, 1.26793f, 0.73210f)
     },
     MozPolygon {
-      Point4D(-0.00000f, -2.73200f, 0.73210f, 1.0f),
-      Point4D(-0.00000f, -0.73200f, -2.73200f, 1.0f),
-      Point4D(0.00010f, 2.73210f, -0.73200f, 1.0f),
-      Point4D(0.00010f, 0.73210f, 2.73210f, 1.0f)
+      Point3D(-0.00000f, -2.73200f, 0.73210f),
+      Point3D(-0.00000f, -0.73200f, -2.73200f),
+      Point3D(0.00010f, 2.73210f, -0.73200f),
+      Point3D(0.00010f, 0.73210f, 2.73210f)
     },
     MozPolygon {
-      Point4D(2.00000f, 1.26793f, 0.73210f, 1.0f),
-      Point4D(2.00000f, 1.73210f, 1.00010f, 1.0f),
-      Point4D(-2.00000f, 1.73210f, 1.00010f, 1.0f),
-      Point4D(-2.00000f, 1.26793f, 0.73210f, 1.0f)
+      Point3D(2.00000f, 1.26793f, 0.73210f),
+      Point3D(2.00000f, 1.73210f, 1.00010f),
+      Point3D(-2.00000f, 1.73210f, 1.00010f),
+      Point3D(-2.00000f, 1.26793f, 0.73210f)
     }
   };
   ::RunTest(polygons, expected);
 }
 
 TEST(BSPTree, TwoPlaneIntersectRotate260degrees) {
   const std::deque<MozPolygon> polygons {
     MozPolygon {
-      Point4D(-0.00000f, 1.19540f, 2.56350f, 1.0f),
-      Point4D(-0.00000f, -2.56340f, 1.19540f, 1.0f),
-      Point4D(0.00010f, -1.19530f, -2.56340f, 1.0f),
-      Point4D(0.00010f, 2.56350f, -1.19530f, 1.0f)
+      Point3D(-0.00000f, 1.19540f, 2.56350f),
+      Point3D(-0.00000f, -2.56340f, 1.19540f),
+      Point3D(0.00010f, -1.19530f, -2.56340f),
+      Point3D(0.00010f, 2.56350f, -1.19530f)
     },
     MozPolygon {
-      Point4D(2.00000f, -0.68400f, 1.87940f, 1.0f),
-      Point4D(2.00000f, 0.68410f, -1.87930f, 1.0f),
-      Point4D(-2.00000f, 0.68410f, -1.87930f, 1.0f),
-      Point4D(-2.00000f, -0.68400f, 1.87940f, 1.0f)
+      Point3D(2.00000f, -0.68400f, 1.87940f),
+      Point3D(2.00000f, 0.68410f, -1.87930f),
+      Point3D(-2.00000f, 0.68410f, -1.87930f),
+      Point3D(-2.00000f, -0.68400f, 1.87940f)
     }
   };
 
   const std::deque<MozPolygon> expected {
     MozPolygon {
-      Point4D(2.00000f, -0.68400f, 1.87940f, 1.0f),
-      Point4D(2.00000f, 0.68410f, -1.87930f, 1.0f),
-      Point4D(-2.00000f, 0.68410f, -1.87930f, 1.0f),
-      Point4D(-2.00000f, -0.68400f, 1.87940f, 1.0f)
+      Point3D(2.00000f, -0.68400f, 1.87940f),
+      Point3D(2.00000f, 0.68410f, -1.87930f),
+      Point3D(-2.00000f, 0.68410f, -1.87930f),
+      Point3D(-2.00000f, -0.68400f, 1.87940f)
     },
     MozPolygon {
-      Point4D(-0.00000f, 1.19540f, 2.56350f, 1.0f),
-      Point4D(-0.00000f, -2.56340f, 1.19540f, 1.0f),
-      Point4D(0.00010f, -1.19530f, -2.56340f, 1.0f),
-      Point4D(0.00010f, 2.56350f, -1.19530f, 1.0f)
+      Point3D(-0.00000f, 1.19540f, 2.56350f),
+      Point3D(-0.00000f, -2.56340f, 1.19540f),
+      Point3D(0.00010f, -1.19530f, -2.56340f),
+      Point3D(0.00010f, 2.56350f, -1.19530f)
     }
   };
   ::RunTest(polygons, expected);
 }
 
 TEST(BSPTree, TwoPlaneIntersectRotate280degrees) {
   const std::deque<MozPolygon> polygons {
     MozPolygon {
-      Point4D(-0.00000f, 2.73210f, -0.73200f, 1.0f),
-      Point4D(-0.00000f, 0.73210f, 2.73210f, 1.0f),
-      Point4D(0.00010f, -2.73200f, 0.73210f, 1.0f),
-      Point4D(0.00010f, -0.73200f, -2.73200f, 1.0f)
+      Point3D(-0.00000f, 2.73210f, -0.73200f),
+      Point3D(-0.00000f, 0.73210f, 2.73210f),
+      Point3D(0.00010f, -2.73200f, 0.73210f),
+      Point3D(0.00010f, -0.73200f, -2.73200f)
     },
     MozPolygon {
-      Point4D(2.00000f, 1.73210f, 1.00010f, 1.0f),
-      Point4D(2.00000f, -1.73200f, -1.00000f, 1.0f),
-      Point4D(-2.00000f, -1.73200f, -1.00000f, 1.0f),
-      Point4D(-2.00000f, 1.73210f, 1.00010f, 1.0f)
+      Point3D(2.00000f, 1.73210f, 1.00010f),
+      Point3D(2.00000f, -1.73200f, -1.00000f),
+      Point3D(-2.00000f, -1.73200f, -1.00000f),
+      Point3D(-2.00000f, 1.73210f, 1.00010f)
     }
   };
 
   const std::deque<MozPolygon> expected {
     MozPolygon {
-      Point4D(2.00000f, -1.26783f, -0.73200f, 1.0f),
-      Point4D(2.00000f, -1.73200f, -1.00000f, 1.0f),
-      Point4D(-2.00000f, -1.73200f, -1.00000f, 1.0f),
-      Point4D(-2.00000f, -1.26783f, -0.73200f, 1.0f)
+      Point3D(2.00000f, -1.26783f, -0.73200f),
+      Point3D(2.00000f, -1.73200f, -1.00000f),
+      Point3D(-2.00000f, -1.73200f, -1.00000f),
+      Point3D(-2.00000f, -1.26783f, -0.73200f)
     },
     MozPolygon {
-      Point4D(-0.00000f, 2.73210f, -0.73200f, 1.0f),
-      Point4D(-0.00000f, 0.73210f, 2.73210f, 1.0f),
-      Point4D(0.00010f, -2.73200f, 0.73210f, 1.0f),
-      Point4D(0.00010f, -0.73200f, -2.73200f, 1.0f)
+      Point3D(-0.00000f, 2.73210f, -0.73200f),
+      Point3D(-0.00000f, 0.73210f, 2.73210f),
+      Point3D(0.00010f, -2.73200f, 0.73210f),
+      Point3D(0.00010f, -0.73200f, -2.73200f)
     },
     MozPolygon {
-      Point4D(-2.00000f, -1.26783f, -0.73200f, 1.0f),
-      Point4D(-2.00000f, 1.73210f, 1.00010f, 1.0f),
-      Point4D(2.00000f, 1.73210f, 1.00010f, 1.0f),
-      Point4D(2.00000f, -1.26783f, -0.73200f, 1.0f)
+      Point3D(-2.00000f, -1.26783f, -0.73200f),
+      Point3D(-2.00000f, 1.73210f, 1.00010f),
+      Point3D(2.00000f, 1.73210f, 1.00010f),
+      Point3D(2.00000f, -1.26783f, -0.73200f)
     }
   };
   ::RunTest(polygons, expected);
 }
 
 TEST(BSPTree, TwoPlaneIntersectRotate300degrees) {
   const std::deque<MozPolygon> polygons {
     MozPolygon {
-      Point4D(-0.00000f, 0.73210f, -2.73200f, 1.0f),
-      Point4D(-0.00000f, 2.73210f, 0.73210f, 1.0f),
-      Point4D(0.00010f, -0.73200f, 2.73210f, 1.0f),
-      Point4D(0.00010f, -2.73200f, -0.73200f, 1.0f)
+      Point3D(-0.00000f, 0.73210f, -2.73200f),
+      Point3D(-0.00000f, 2.73210f, 0.73210f),
+      Point3D(0.00010f, -0.73200f, 2.73210f),
+      Point3D(0.00010f, -2.73200f, -0.73200f)
     },
     MozPolygon {
-      Point4D(2.00000f, 1.73210f, -0.99990f, 1.0f),
-      Point4D(2.00000f, -1.73200f, 1.00000f, 1.0f),
-      Point4D(-2.00000f, -1.73200f, 1.00000f, 1.0f),
-      Point4D(-2.00000f, 1.73210f, -0.99990f, 1.0f)
+      Point3D(2.00000f, 1.73210f, -0.99990f),
+      Point3D(2.00000f, -1.73200f, 1.00000f),
+      Point3D(-2.00000f, -1.73200f, 1.00000f),
+      Point3D(-2.00000f, 1.73210f, -0.99990f)
     }
   };
 
   const std::deque<MozPolygon> expected {
     MozPolygon {
-      Point4D(-0.00000f, 0.73210f, -2.73200f, 1.0f),
-      Point4D(-0.00000f, 2.73210f, 0.73210f, 1.0f),
-      Point4D(0.00010f, -0.73200f, 2.73210f, 1.0f),
-      Point4D(0.00010f, -2.73200f, -0.73200f, 1.0f)
+      Point3D(-0.00000f, 0.73210f, -2.73200f),
+      Point3D(-0.00000f, 2.73210f, 0.73210f),
+      Point3D(0.00010f, -0.73200f, 2.73210f),
+      Point3D(0.00010f, -2.73200f, -0.73200f)
     },
     MozPolygon {
-      Point4D(2.00000f, 1.73210f, -0.99990f, 1.0f),
-      Point4D(2.00000f, -1.73200f, 1.00000f, 1.0f),
-      Point4D(-2.00000f, -1.73200f, 1.00000f, 1.0f),
-      Point4D(-2.00000f, 1.73210f, -0.99990f, 1.0f)
+      Point3D(2.00000f, 1.73210f, -0.99990f),
+      Point3D(2.00000f, -1.73200f, 1.00000f),
+      Point3D(-2.00000f, -1.73200f, 1.00000f),
+      Point3D(-2.00000f, 1.73210f, -0.99990f)
     }
   };
   ::RunTest(polygons, expected);
 }
 
 TEST(BSPTree, TwoPlaneIntersectRotate320degrees) {
   const std::deque<MozPolygon> polygons {
     MozPolygon {
-      Point4D(-0.00000f, -1.19530f, -2.56340f, 1.0f),
-      Point4D(-0.00000f, 2.56350f, -1.19530f, 1.0f),
-      Point4D(0.00010f, 1.19540f, 2.56350f, 1.0f),
-      Point4D(0.00010f, -2.56340f, 1.19540f, 1.0f)
+      Point3D(-0.00000f, -1.19530f, -2.56340f),
+      Point3D(-0.00000f, 2.56350f, -1.19530f),
+      Point3D(0.00010f, 1.19540f, 2.56350f),
+      Point3D(0.00010f, -2.56340f, 1.19540f)
     },
     MozPolygon {
-      Point4D(2.00000f, 0.68410f, -1.87930f, 1.0f),
-      Point4D(2.00000f, -0.68400f, 1.87940f, 1.0f),
-      Point4D(-2.00000f, -0.68400f, 1.87940f, 1.0f),
-      Point4D(-2.00000f, 0.68410f, -1.87930f, 1.0f)
+      Point3D(2.00000f, 0.68410f, -1.87930f),
+      Point3D(2.00000f, -0.68400f, 1.87940f),
+      Point3D(-2.00000f, -0.68400f, 1.87940f),
+      Point3D(-2.00000f, 0.68410f, -1.87930f)
     }
   };
 
   const std::deque<MozPolygon> expected {
     MozPolygon {
-      Point4D(-0.00000f, -1.19530f, -2.56340f, 1.0f),
-      Point4D(-0.00000f, 2.56350f, -1.19530f, 1.0f),
-      Point4D(0.00010f, 1.19540f, 2.56350f, 1.0f),
-      Point4D(0.00010f, -2.56340f, 1.19540f, 1.0f)
+      Point3D(-0.00000f, -1.19530f, -2.56340f),
+      Point3D(-0.00000f, 2.56350f, -1.19530f),
+      Point3D(0.00010f, 1.19540f, 2.56350f),
+      Point3D(0.00010f, -2.56340f, 1.19540f)
     },
     MozPolygon {
-      Point4D(2.00000f, 0.68410f, -1.87930f, 1.0f),
-      Point4D(2.00000f, -0.68400f, 1.87940f, 1.0f),
-      Point4D(-2.00000f, -0.68400f, 1.87940f, 1.0f),
-      Point4D(-2.00000f, 0.68410f, -1.87930f, 1.0f)
+      Point3D(2.00000f, 0.68410f, -1.87930f),
+      Point3D(2.00000f, -0.68400f, 1.87940f),
+      Point3D(-2.00000f, -0.68400f, 1.87940f),
+      Point3D(-2.00000f, 0.68410f, -1.87930f)
     }
   };
   ::RunTest(polygons, expected);
 }
 
 TEST(BSPTree, TwoPlaneIntersectRotate340degrees) {
   const std::deque<MozPolygon> polygons {
     MozPolygon {
-      Point4D(-0.00000f, -2.00000f, -2.00000f, 1.0f),
-      Point4D(-0.00000f, 2.00000f, -2.00000f, 1.0f),
-      Point4D(0.00010f, 2.00000f, 2.00000f, 1.0f),
-      Point4D(0.00010f, -2.00000f, 2.00000f, 1.0f)
+      Point3D(-0.00000f, -2.00000f, -2.00000f),
+      Point3D(-0.00000f, 2.00000f, -2.00000f),
+      Point3D(0.00010f, 2.00000f, 2.00000f),
+      Point3D(0.00010f, -2.00000f, 2.00000f)
     },
     MozPolygon {
-      Point4D(2.00000f, 0.00010f, -2.00000f, 1.0f),
-      Point4D(2.00000f, -0.00000f, 2.00000f, 1.0f),
-      Point4D(-2.00000f, -0.00000f, 2.00000f, 1.0f),
-      Point4D(-2.00000f, 0.00010f, -2.00000f, 1.0f)
+      Point3D(2.00000f, 0.00010f, -2.00000f),
+      Point3D(2.00000f, -0.00000f, 2.00000f),
+      Point3D(-2.00000f, -0.00000f, 2.00000f),
+      Point3D(-2.00000f, 0.00010f, -2.00000f)
     }
   };
 
   const std::deque<MozPolygon> expected {
     MozPolygon {
-      Point4D(-0.00000f, -2.00000f, -2.00000f, 1.0f),
-      Point4D(-0.00000f, 2.00000f, -2.00000f, 1.0f),
-      Point4D(0.00010f, 2.00000f, 2.00000f, 1.0f),
-      Point4D(0.00010f, -2.00000f, 2.00000f, 1.0f)
+      Point3D(-0.00000f, -2.00000f, -2.00000f),
+      Point3D(-0.00000f, 2.00000f, -2.00000f),
+      Point3D(0.00010f, 2.00000f, 2.00000f),
+      Point3D(0.00010f, -2.00000f, 2.00000f)
     },
     MozPolygon {
-      Point4D(2.00000f, 0.00010f, -2.00000f, 1.0f),
-      Point4D(2.00000f, -0.00000f, 2.00000f, 1.0f),
-      Point4D(-2.00000f, -0.00000f, 2.00000f, 1.0f),
-      Point4D(-2.00000f, 0.00010f, -2.00000f, 1.0f)
+      Point3D(2.00000f, 0.00010f, -2.00000f),
+      Point3D(2.00000f, -0.00000f, 2.00000f),
+      Point3D(-2.00000f, -0.00000f, 2.00000f),
+      Point3D(-2.00000f, 0.00010f, -2.00000f)
     }
   };
   ::RunTest(polygons, expected);
 }
 
 TEST(BSPTree, TwoPlaneIntersectRotate360degrees) {
   const std::deque<MozPolygon> polygons {
     MozPolygon {
-      Point4D(-0.00000f, -2.00000f, -2.00000f, 1.0f),
-      Point4D(-0.00000f, 2.00000f, -2.00000f, 1.0f),
-      Point4D(0.00010f, 2.00000f, 2.00000f, 1.0f),
-      Point4D(0.00010f, -2.00000f, 2.00000f, 1.0f)
+      Point3D(-0.00000f, -2.00000f, -2.00000f),
+      Point3D(-0.00000f, 2.00000f, -2.00000f),
+      Point3D(0.00010f, 2.00000f, 2.00000f),
+      Point3D(0.00010f, -2.00000f, 2.00000f)
     },
     MozPolygon {
-      Point4D(2.00000f, 0.00010f, -2.00000f, 1.0f),
-      Point4D(2.00000f, -0.00000f, 2.00000f, 1.0f),
-      Point4D(-2.00000f, -0.00000f, 2.00000f, 1.0f),
-      Point4D(-2.00000f, 0.00010f, -2.00000f, 1.0f)
+      Point3D(2.00000f, 0.00010f, -2.00000f),
+      Point3D(2.00000f, -0.00000f, 2.00000f),
+      Point3D(-2.00000f, -0.00000f, 2.00000f),
+      Point3D(-2.00000f, 0.00010f, -2.00000f)
     }
   };
 
   const std::deque<MozPolygon> expected {
     MozPolygon {
-      Point4D(-0.00000f, -2.00000f, -2.00000f, 1.0f),
-      Point4D(-0.00000f, 2.00000f, -2.00000f, 1.0f),
-      Point4D(0.00010f, 2.00000f, 2.00000f, 1.0f),
-      Point4D(0.00010f, -2.00000f, 2.00000f, 1.0f)
+      Point3D(-0.00000f, -2.00000f, -2.00000f),
+      Point3D(-0.00000f, 2.00000f, -2.00000f),
+      Point3D(0.00010f, 2.00000f, 2.00000f),
+      Point3D(0.00010f, -2.00000f, 2.00000f)
     },
     MozPolygon {
-      Point4D(2.00000f, 0.00010f, -2.00000f, 1.0f),
-      Point4D(2.00000f, -0.00000f, 2.00000f, 1.0f),
-      Point4D(-2.00000f, -0.00000f, 2.00000f, 1.0f),
-      Point4D(-2.00000f, 0.00010f, -2.00000f, 1.0f)
+      Point3D(2.00000f, 0.00010f, -2.00000f),
+      Point3D(2.00000f, -0.00000f, 2.00000f),
+      Point3D(-2.00000f, -0.00000f, 2.00000f),
+      Point3D(-2.00000f, 0.00010f, -2.00000f)
     }
   };
   ::RunTest(polygons, expected);
 }
--- a/gfx/tests/gtest/TestPolygon.cpp
+++ b/gfx/tests/gtest/TestPolygon.cpp
@@ -13,39 +13,39 @@
 #include "Triangle.h"
 
 using namespace mozilla::gfx;
 typedef mozilla::gfx::Polygon MozPolygon;
 
 TEST(MozPolygon, TriangulateRectangle)
 {
   const MozPolygon p {
-    Point4D(0.0f, 0.0f, 1.0f, 1.0f),
-    Point4D(0.0f, 1.0f, 1.0f, 1.0f),
-    Point4D(1.0f, 1.0f, 1.0f, 1.0f),
-    Point4D(1.0f, 0.0f, 1.0f, 1.0f)
+    Point3D(0.0f, 0.0f, 1.0f),
+    Point3D(0.0f, 1.0f, 1.0f),
+    Point3D(1.0f, 1.0f, 1.0f),
+    Point3D(1.0f, 0.0f, 1.0f)
   };
 
   const nsTArray<Triangle> triangles = p.ToTriangles();
   const nsTArray<Triangle> expected = {
     Triangle(Point(0.0f, 0.0f), Point(0.0f, 1.0f), Point(1.0f, 1.0f)),
     Triangle(Point(0.0f, 0.0f), Point(1.0f, 1.0f), Point(1.0f, 0.0f))
   };
 
   AssertArrayEQ(triangles, expected);
 }
 
 TEST(MozPolygon, TriangulatePentagon)
 {
   const MozPolygon p {
-    Point4D(0.0f, 0.0f, 1.0f, 1.0f),
-    Point4D(0.0f, 1.0f, 1.0f, 1.0f),
-    Point4D(0.5f, 1.5f, 1.0f, 1.0f),
-    Point4D(1.0f, 1.0f, 1.0f, 1.0f),
-    Point4D(1.0f, 0.0f, 1.0f, 1.0f)
+    Point3D(0.0f, 0.0f, 1.0f),
+    Point3D(0.0f, 1.0f, 1.0f),
+    Point3D(0.5f, 1.5f, 1.0f),
+    Point3D(1.0f, 1.0f, 1.0f),
+    Point3D(1.0f, 0.0f, 1.0f)
   };
 
   const nsTArray<Triangle> triangles = p.ToTriangles();
   const nsTArray<Triangle> expected = {
     Triangle(Point(0.0f, 0.0f), Point(0.0f, 1.0f), Point(0.5f, 1.5f)),
     Triangle(Point(0.0f, 0.0f), Point(0.5f, 1.5f), Point(1.0f, 1.0f)),
     Triangle(Point(0.0f, 0.0f), Point(1.0f, 1.0f), Point(1.0f, 0.0f))
   };
@@ -60,77 +60,77 @@ TestClipRect(const MozPolygon& aPolygon,
 {
   const MozPolygon res = aPolygon.ClipPolygon(MozPolygon::FromRect(aRect));
   EXPECT_TRUE(res == aExpected);
 }
 
 TEST(MozPolygon, ClipRectangle)
 {
   MozPolygon polygon {
-    Point4D(0.0f, 0.0f, 0.0f, 1.0f),
-    Point4D(0.0f, 1.0f, 0.0f, 1.0f),
-    Point4D(1.0f, 1.0f, 0.0f, 1.0f),
-    Point4D(1.0f, 0.0f, 0.0f, 1.0f)
+    Point3D(0.0f, 0.0f, 0.0f),
+    Point3D(0.0f, 1.0f, 0.0f),
+    Point3D(1.0f, 1.0f, 0.0f),
+    Point3D(1.0f, 0.0f, 0.0f)
   };
   TestClipRect(polygon, polygon, Rect(0.0f, 0.0f, 1.0f, 1.0f));
 
   MozPolygon expected = MozPolygon {
-    Point4D(0.0f, 0.0f, 0.0f, 1.0f),
-    Point4D(0.0f, 0.8f, 0.0f, 1.0f),
-    Point4D(0.8f, 0.8f, 0.0f, 1.0f),
-    Point4D(0.8f, 0.0f, 0.0f, 1.0f)
+    Point3D(0.0f, 0.0f, 0.0f),
+    Point3D(0.0f, 0.8f, 0.0f),
+    Point3D(0.8f, 0.8f, 0.0f),
+    Point3D(0.8f, 0.0f, 0.0f)
   };
   TestClipRect(polygon, expected, Rect(0.0f, 0.0f, 0.8f, 0.8f));
 
   expected = MozPolygon {
-    Point4D(0.2f, 0.2f, 0.0f, 1.0f),
-    Point4D(0.2f, 1.0f, 0.0f, 1.0f),
-    Point4D(1.0f, 1.0f, 0.0f, 1.0f),
-    Point4D(1.0f, 0.2f, 0.0f, 1.0f)
+    Point3D(0.2f, 0.2f, 0.0f),
+    Point3D(0.2f, 1.0f, 0.0f),
+    Point3D(1.0f, 1.0f, 0.0f),
+    Point3D(1.0f, 0.2f, 0.0f)
   };
   TestClipRect(polygon, expected, Rect(0.2f, 0.2f, 0.8f, 0.8f));
 
   expected = MozPolygon {
-    Point4D(0.2f, 0.2f, 0.0f, 1.0f),
-    Point4D(0.2f, 0.8f, 0.0f, 1.0f),
-    Point4D(0.8f, 0.8f, 0.0f, 1.0f),
-    Point4D(0.8f, 0.2f, 0.0f, 1.0f)
+    Point3D(0.2f, 0.2f, 0.0f),
+    Point3D(0.2f, 0.8f, 0.0f),
+    Point3D(0.8f, 0.8f, 0.0f),
+    Point3D(0.8f, 0.2f, 0.0f)
   };
   TestClipRect(polygon, expected, Rect(0.2f, 0.2f, 0.6f, 0.6f));
 }
 
 TEST(MozPolygon, ClipTriangle)
 {
   MozPolygon clipped, expected;
   const MozPolygon polygon {
-    Point4D(0.0f, 0.0f, 0.0f, 1.0f),
-    Point4D(0.0f, 1.0f, 0.0f, 1.0f),
-    Point4D(1.0f, 1.0f, 0.0f, 1.0f)
+    Point3D(0.0f, 0.0f, 0.0f),
+    Point3D(0.0f, 1.0f, 0.0f),
+    Point3D(1.0f, 1.0f, 0.0f)
   };
 
   expected = MozPolygon {
-    Point4D(0.0f, 0.0f, 0.0f, 1.0f),
-    Point4D(0.0f, 1.0f, 0.0f, 1.0f),
-    Point4D(1.0f, 1.0f, 0.0f, 1.0f)
+    Point3D(0.0f, 0.0f, 0.0f),
+    Point3D(0.0f, 1.0f, 0.0f),
+    Point3D(1.0f, 1.0f, 0.0f)
   };
   TestClipRect(polygon, expected, Rect(0.0f, 0.0f, 1.0f, 1.0f));
 
   expected = MozPolygon {
-    Point4D(0.0f, 0.0f, 0.0f, 1.0f),
-    Point4D(0.0f, 0.8f, 0.0f, 1.0f),
-    Point4D(0.8f, 0.8f, 0.0f, 1.0f)
+    Point3D(0.0f, 0.0f, 0.0f),
+    Point3D(0.0f, 0.8f, 0.0f),
+    Point3D(0.8f, 0.8f, 0.0f)
   };
   TestClipRect(polygon, expected, Rect(0.0f, 0.0f, 0.8f, 0.8f));
 
   expected = MozPolygon {
-    Point4D(0.2f, 0.2f, 0.0f, 1.0f),
-    Point4D(0.2f, 1.0f, 0.0f, 1.0f),
-    Point4D(1.0f, 1.0f, 0.0f, 1.0f)
+    Point3D(0.2f, 0.2f, 0.0f),
+    Point3D(0.2f, 1.0f, 0.0f),
+    Point3D(1.0f, 1.0f, 0.0f)
   };
   TestClipRect(polygon, expected, Rect(0.2f, 0.2f, 0.8f, 0.8f));
 
   expected = MozPolygon {
-    Point4D(0.2f, 0.2f, 0.0f, 1.0f),
-    Point4D(0.2f, 0.8f, 0.0f, 1.0f),
-    Point4D(0.8f, 0.8f, 0.0f, 1.0f)
+    Point3D(0.2f, 0.2f, 0.0f),
+    Point3D(0.2f, 0.8f, 0.0f),
+    Point3D(0.8f, 0.8f, 0.0f)
   };
   TestClipRect(polygon, expected, Rect(0.2f, 0.2f, 0.6f, 0.6f));
 }