Exemplo n.º 1
0
    def test_check_for_intersections_1(self):
        io = MultiPolyMesherIo(())
        io.check_topology = True

        poly_input = PolyInput(outside_polygon=((0, 0, 0), (100, 0, 0),
                                                (100, 10, 0), (0, -10, 0)))
        io.poly_inputs = (poly_input, )

        expected = \
            "---Error: Input polygon segments intersect. The segment defined by points 0 and 1 of outer " \
            "polygon 0 intersects with the segment defined by points 2 and 3 of outer polygon 0.\n" \
            "\n\n"

        (success, errors) = mesh_utils.generate_mesh(io)
        self.assertEqual(False, success)
        self.assertEqual(expected, errors)
Exemplo n.º 2
0
 def test_simple_polygon(self):
     outside_poly = [(0, 10, 0), (0, 20, 0), (0, 30, 0), (0, 40, 0),
                     (0, 50, 0), (0, 60, 0), (0, 70, 0), (0, 80, 0),
                     (0, 90, 0), (0, 100, 0), (10, 100, 0), (20, 100, 0),
                     (30, 100, 0), (40, 100, 0), (50, 100, 0), (60, 100, 0),
                     (70, 100, 0), (80, 100, 0), (90, 100, 0),
                     (100, 100, 0), (100, 90, 0), (100, 80, 0),
                     (100, 70, 0), (100, 60, 0), (100, 50, 0), (100, 40, 0),
                     (100, 30, 0), (100, 20, 0), (100, 10, 0), (100, 0, 0),
                     (90, 0, 0), (80, 0, 0), (70, 0, 0), (60, 0, 0),
                     (50, 0, 0), (40, 0, 0), (30, 0, 0), (20, 0, 0),
                     (10, 0, 0), (0, 0, 0)]
     inside_polys = [[(40, 40, 0), (50, 40, 0), (60, 40, 0), (60, 50, 0),
                      (60, 60, 0), (50, 60, 0), (40, 60, 0), (40, 50, 0)]]
     input_poly = PolyInput(outside_poly, inside_polys)
     input = MultiPolyMesherIo(())
     input.poly_inputs = [input_poly]
     status, error = mesh_utils.generate_mesh(input)
     self.assertEqual(139, len(input.points))
     self.assertEqual(1150, len(input.cells))
     self.assertTrue(status)
     self.assertEqual(error, '')