Exemplo n.º 1
0
 def test_3D(self):
     vertices = np.array([[0, 0, 0], [1, 0, 1], [1, 1, 1], [0, 1, 0]],
                         dtype=float)
     segments = np.array([[0, 1], [1, 2], [2, 3], [3, 0]], dtype=int)
     vertices, faces = triangulate(vertices, segments, 0.1)
     self.assertLess(4, len(vertices))
     self.assertLess(2, len(faces))
     self.assert_array_almost_equal([1.0, 1.0, 1.0],
                                    np.amax(vertices, axis=0))
     self.assert_array_almost_equal([0.0, 0.0, 0.0],
                                    np.amin(vertices, axis=0))
Exemplo n.º 2
0
    def test_2D(self):
        vertices = np.array([
            [0, 0],
            [1, 0],
            [1, 1],
            [0, 1] ], dtype=float);
        segments = np.array([
            [0, 1],
            [1, 2],
            [2, 3],
            [3, 0] ], dtype=int);

        vertices, faces = triangulate(vertices, segments, 0.1);
        self.assertLess(4, len(vertices));
        self.assertLess(2, len(faces));
        self.assert_array_almost_equal([1.0, 1.0], np.amax(vertices, axis=0));
        self.assert_array_almost_equal([0.0, 0.0], np.amin(vertices, axis=0));