Beispiel #1
0
    def __init__(self,
                 cell_complex,
                 horizon=0,
                 min_ratio=0.0,
                 coverage_threshold=1.):

        assert isinstance(
            cell_complex, models.CellComplex2D
        ), "Expected type CellComplex2D, got %s instead" % type(cell_complex)

        self.horizon = horizon
        self.min_ratio = min_ratio
        self.H = cell_complex.cell_graph(coverage_threshold=coverage_threshold)
        self.G = utilities.filter_boundary_edges(self.H)
Beispiel #2
0
    def test_partition_with_boundary2(self):

        cell_complex = models.CellComplex2D(0, 20, 10)
        cutting_plane = models.Plane.from_axis_distance(np.array([1, 1, 0]), 1)
        boundary = simulator.rectangle(cutting_plane, 2, 1, 4, 2)

        cell_complex.insert_partition(cutting_plane)
        cell_complex.insert_boundary(boundary)

        G = nx.to_networkx_graph({0: [1], 1: [0]})
        H = cell_complex.cell_graph(coverage_threshold=4.1)

        self.assertTrue(nx.is_isomorphic(G,
                                         utilities.filter_boundary_edges(H)))
        self.assertEqual(6, len(cell_complex.vertices))

        cell_complex.draw(scene_graph=H)