コード例 #1
0
    def test_geometry_polygone(self):
        fLOG(
            __file__,
            self._testMethodName,
            OutputPrint=__name__ == "__main__")
        middle = GeometryPoint(GeometryPoint(0.5, 0.1))

        poly = GeometryPolygone([GeometryPoint(0, 0), GeometryPoint(1, 0),
                                 GeometryPoint(1, 1), GeometryPoint(0, 1)])
        r = poly.in_convex(middle)
        assert r
        out = GeometryPoint(0.5, -0.1)
        r = poly.in_convex(out)
        assert not r
コード例 #2
0
    def test_geometry_polygone2(self):
        fLOG(
            __file__,
            self._testMethodName,
            OutputPrint=__name__ == "__main__")

        poly = GeometryPolygone([GeometryPoint(0, 0), GeometryPoint(0, 1),
                                 GeometryPoint(1, 1), GeometryPoint(1, 0)])
        convex = poly.convex()
        fLOG(convex)
        self.assertEqual(len(convex), len(poly))
        r = [GeometryPoint(0, 1), GeometryPoint(
            0, 0), GeometryPoint(1, 0), GeometryPoint(1, 1)]
        for p, e in zip(convex, r):
            self.assertEqual(p, e)
コード例 #3
0
    def test_geometry_polygone(self):
        fLOG(__file__,
             self._testMethodName,
             OutputPrint=__name__ == "__main__")
        middle = GeometryPoint(GeometryPoint(0.5, 0.1))

        poly = GeometryPolygone([
            GeometryPoint(0, 0),
            GeometryPoint(1, 0),
            GeometryPoint(1, 1),
            GeometryPoint(0, 1)
        ])
        r = poly.in_convex(middle)
        assert r
        out = GeometryPoint(0.5, -0.1)
        r = poly.in_convex(out)
        assert not r
コード例 #4
0
    def test_geometry_polygone2(self):
        fLOG(__file__,
             self._testMethodName,
             OutputPrint=__name__ == "__main__")

        poly = GeometryPolygone([
            GeometryPoint(0, 0),
            GeometryPoint(0, 1),
            GeometryPoint(1, 1),
            GeometryPoint(1, 0)
        ])
        convex = poly.convex()
        fLOG(convex)
        self.assertEqual(len(convex), len(poly))
        r = [
            GeometryPoint(0, 1),
            GeometryPoint(0, 0),
            GeometryPoint(1, 0),
            GeometryPoint(1, 1)
        ]
        for p, e in zip(convex, r):
            self.assertEqual(p, e)