             temp.closeSubpath()
             return Path(cgPath: temp)
         }()
-        let resultUnion = square1.union(square2)!
-        XCTAssertEqual(resultUnion.components.count, 1)
-        XCTAssertTrue(componentsEqualAsideFromElementOrdering(resultUnion.components[0], expectedUnion.components[0]))
-    }
-
-//    func testUnionCoincidentEdgesRealWorldTestCase() {
-//        let star = {() -> Path in
-//            let temp = CGMutablePath()
-//            temp.move(to: CGPoint(x: 111.2, y: 90.0))
-//            temp.addLine(to: CGPoint(x: 144.72135954999578, y:137.02282018339787))
-//            temp.addLine(to: CGPoint(x: 89.64133022449836, y: 119.6729633084088))
-//            temp.addLine(to: CGPoint(x: 55.27864045000421, y: 166.0845213036123))
-//            temp.addLine(to: CGPoint(x: 54.758669775501644, y: 108.33889987152517))
-//            temp.addLine(to: CGPoint(x: 0.0, y:  90.00000000000001))
-//            temp.addLine(to: CGPoint(x: 54.75866977550164, y: 71.66110012847484))
-//            temp.addLine(to: CGPoint(x: 55.2786404500042, y: 13.915478696387723))
-//            temp.addLine(to: CGPoint(x: 89.64133022449835, y: 60.3270366915912))
-//            temp.addLine(to: CGPoint(x: 144.72135954999578, y: 42.97717981660214))
-//            temp.closeSubpath()
-//            return Path(cgPath: temp)
-//        }()
-//        let polygon = {() -> Path in
-//            let temp = CGMutablePath()
-//            temp.move(to: CGPoint(x: 89.64133022449836, y: 119.6729633084088))
-//            temp.addLine(to: CGPoint(x: 55.27864045000421, y: 166.0845213036123))
-//            temp.addLine(to: CGPoint(x: 143.9588334407257, y: 125.35115333505796))
-//            temp.addLine(to: CGPoint(x: 160.7501485041311, y: 111.6759272531885))
-//            temp.closeSubpath()
-//            return Path(cgPath: temp)
-//        }()
-////        let unionResult = star.union(polygon)!
-////        XCTAssertEqual(unionResult.components.count, 1)
-//    }
+        let resultUnion1 = square1.union(square2)!
+        XCTAssertEqual(resultUnion1.components.count, 1)
+        XCTAssertTrue(componentsEqualAsideFromElementOrdering(resultUnion1.components[0], expectedUnion.components[0]))
+        // check that it also works if the path is reversed
+        let resultUnion2 = square1.union(square2.reversed())!
+        XCTAssertEqual(resultUnion2.components.count, 1)
+        XCTAssertTrue(componentsEqualAsideFromElementOrdering(resultUnion2.components[0], expectedUnion.components[0]))
+    }
+
+    func testUnionCoincidentEdgesRealWorldTestCase1() {
+        let polygon1 = {() -> Path in
+            let temp = CGMutablePath()
+            temp.addLines(between: [CGPoint(x: 111.2, y: 90.0),
+                                    CGPoint(x: 144.72135954999578, y: 137.02282018339787),
+                                    CGPoint(x: 179.15338649848962, y: 123.08999319271176),
+                                    CGPoint(x: 171.33627533401454, y: 102.89462632327792)])
+            temp.closeSubpath()
+            return Path(cgPath: temp)
+        }()
+        let polygon2 = {() -> Path in
+            let temp = CGMutablePath()
+            temp.addLines(between: [CGPoint(x: 144.72135954999578, y: 137.02282018339787),
+                                    CGPoint(x: 89.64133022449836, y: 119.6729633084088),
+                                    CGPoint(x: 160.7501485041311, y: 111.6759272531885),
+                                    CGPoint(x: 179.15338649848962, y: 123.08999319271176)])
+            temp.closeSubpath()
+            return Path(cgPath: temp)
+        }()
+        // polygon 1 & 2 share two points in common
+        // polygon 1's [1] point is polygon 2's [0] point
+        // polygon 1's [2] point is polygon 2's [3] point
+        let unionResult1 = polygon1.union(polygon2)!
+        XCTAssertEqual(unionResult1.components.count, 1)
+        XCTAssertEqual(unionResult1.components.first?.points.count, 7)
+
+        let unionResult2 = polygon1.union(polygon2.reversed())!
+        XCTAssertEqual(unionResult2.components.count, 1)
+        XCTAssertEqual(unionResult2.components.first?.points.count, 7)
+    }
+
+    func testUnionCoincidentEdgesRealWorldTestCase2() {
+        let star = {() -> Path in
+            let temp = CGMutablePath()
+            temp.move(to: CGPoint(x: 111.2, y: 90.0))
+            temp.addLine(to: CGPoint(x: 144.72135954999578, y:137.02282018339787))
+            temp.addLine(to: CGPoint(x: 89.64133022449836, y: 119.6729633084088))
+            temp.addLine(to: CGPoint(x: 55.27864045000421, y: 166.0845213036123))
+            temp.addLine(to: CGPoint(x: 54.758669775501644, y: 108.33889987152517))
+            temp.addLine(to: CGPoint(x: 0.0, y:  90.00000000000001))
+            temp.addLine(to: CGPoint(x: 54.75866977550164, y: 71.66110012847484))
+            temp.addLine(to: CGPoint(x: 55.2786404500042, y: 13.915478696387723))
+            temp.addLine(to: CGPoint(x: 89.64133022449835, y: 60.3270366915912))
+            temp.addLine(to: CGPoint(x: 144.72135954999578, y: 42.97717981660214))
+            temp.closeSubpath()
+            return Path(cgPath: temp)
+        }()
+        let polygon = {() -> Path in
+            let temp = CGMutablePath()
+            temp.move(to: CGPoint(x: 89.64133022449836, y: 119.6729633084088))
+            temp.addLine(to: CGPoint(x: 55.27864045000421, y: 166.0845213036123)) // this is marked as an exit if the polygon isn't reversed and it's correct BUT it's unlinked to the other path(!!!)
+            temp.addLine(to: CGPoint(x: 143.9588334407257, y: 125.35115333505796))
+            temp.addLine(to: CGPoint(x: 160.7501485041311, y: 111.6759272531885))
+            temp.closeSubpath()
+            return Path(cgPath: temp)
+        }()
+        let unionResult1 = star.union(polygon)! // ugh, yeah see reversing the polygon causes the correct vertext to be recognized as an exit
+        XCTAssertEqual(unionResult1.components.count, 1)
+
+        let unionResult2 = star.union(polygon.reversed())!
+        XCTAssertEqual(unionResult2.components.count, 1)
+    }
 
     func testUnionRealWorldEdgeCase() {
         guard MemoryLayout<CGFloat>.size > 4 else { return } // not enough precision in points for test to be valid

        cgPath.addLine(to: CGPoint(x: 430.66935231730844, y: 109.24678582975706))
        cgPath.closeSubpath()

        let path = Path(cgPath: cgPath)
        _ = path.crossingsRemoved(accuracy: 0.01)

        // for now the test's only expectation is that we do not go into an infinite loop
        // TODO: make test stricter

                        control1: CGPoint(x: 115.23034681147224, y: 49.19162153453482),
                        control2: CGPoint(x: 130.4334714935808, y: 49.19162153453483))

        #warning("This test effectively disabled")
//        let p = Path(cgPath: cgPath)
//        _ = p.crossingsRemoved(accuracy: 0.0001)
    }

    func testCrossingsRemovedMulticomponent() {
