Пример #1
0
def test_delete_edge(edged_curve, builder):
    to_delete = [False] * edged_curve.nb_edges()
    to_delete[0] = True
    builder.delete_edges(to_delete)
    if edged_curve.nb_edges() != 1:
        raise ValueError("[Test] EdgedCurve should have 1 edges")
    if edged_curve.edge_vertex(mesh.EdgeVertex(0, 0)) != 0:
        raise ValueError("[Test] EdgedCurve edge vertex index is not correct")
    if edged_curve.edge_vertex(mesh.EdgeVertex(0, 1)) != 1:
        raise ValueError("[Test] EdgedCurve edge vertex index is not correct")
Пример #2
0
def test_create_edges(edged_curve, builder):
    builder.create_edge_with_vertices(0, 1)
    builder.create_edge_with_vertices(0, 2)
    if edged_curve.nb_edges() != 2:
        raise ValueError("[Test] EdgedCurve should have 2 edges")
    if edged_curve.edge_vertex(mesh.EdgeVertex(0, 1)) != 1:
        raise ValueError("[Test] EdgedCurve edge vertex is not correct")
    builder.create_edges(2)
    builder.set_edge_vertex(mesh.EdgeVertex(2, 0), 3)
    builder.set_edge_vertex(mesh.EdgeVertex(2, 1), 2)
    builder.set_edge_vertex(mesh.EdgeVertex(3, 0), 1)
    builder.set_edge_vertex(mesh.EdgeVertex(3, 1), 2)
    if edged_curve.nb_edges() != 4:
        raise ValueError("[Test] EdgedCurve should have 4 edges")

    edges_around_0 = edged_curve.edges_around_vertex(0)
    if len(edges_around_0) != 2:
        raise ValueError("[Test] edges_around_0 should have 2 edges")
    if edges_around_0[0].edge_id != 0:
        raise ValueError("[Test] edges_around_0 has wrong value")
    if edges_around_0[0].vertex_id != 0:
        raise ValueError("[Test] edges_around_0 has wrong value")
    if edges_around_0[1].edge_id != 1:
        raise ValueError("[Test] edges_around_0 has wrong value")
    if edges_around_0[1].vertex_id != 0:
        raise ValueError("[Test] edges_around_0 has wrong value")

    edges_around_2 = edged_curve.edges_around_vertex(2)
    if len(edges_around_2) != 3:
        raise ValueError("[Test] edges_around_2 should have 3 edges")
    if edges_around_2[0].edge_id != 1:
        raise ValueError("[Test] edges_around_2 has wrong value")
    if edges_around_2[0].vertex_id != 1:
        raise ValueError("[Test] edges_around_2 has wrong value")
    if edges_around_2[1].edge_id != 2:
        raise ValueError("[Test] edges_around_2 has wrong value")
    if edges_around_2[1].vertex_id != 1:
        raise ValueError("[Test] edges_around_2 has wrong value")
    if edges_around_2[2].edge_id != 3:
        raise ValueError("[Test] edges_around_2 has wrong value")
    if edges_around_2[2].vertex_id != 1:
        raise ValueError("[Test] edges_around_2 has wrong value")
Пример #3
0
def test_delete_edge(graph, builder):
    to_delete = [False] * graph.nb_edges()
    to_delete[0] = True
    builder.delete_edges(to_delete)
    if graph.nb_edges() != 1:
        raise ValueError("[Test] Graph should have 1 edge")
    if graph.edge_vertex(mesh.EdgeVertex(0, 0)) != 0:
        raise ValueError("[Test] Graph edge vertex index is not correct")
    if graph.edge_vertex(mesh.EdgeVertex(0, 1)) != 1:
        raise ValueError("[Test] Graph edge vertex index is not correct")

    builder.create_edges(10)
    builder.set_edge_vertex(mesh.EdgeVertex(1, 0), 1)
    builder.set_edge_vertex(mesh.EdgeVertex(1, 1), 0)
    if graph.nb_edges() != 11:
        raise ValueError("[Test] Graph should have 11 edges")

    to_delete.extend([True] * 9)
    builder.delete_edges(to_delete)
    if graph.nb_edges() != 1:
        raise ValueError("[Test] Graph should have 1 edge")
    if graph.edge_vertex(mesh.EdgeVertex(0, 0)) != 1:
        raise ValueError(
            "[Test] Graph edge vertex index is not correct (0, 0)")
    if graph.edge_vertex(mesh.EdgeVertex(0, 1)) != 0:
        raise ValueError(
            "[Test] Graph edge vertex index is not correct (0, 1)")
def test_permutation(edged_curve, builder):
    builder.permute_vertices([2, 0, 3, 1])
    if edged_curve.point(2) != geom.Point3D([8.7, 1.4, 4.7]):
        raise ValueError(
            "[Test] Point coordinates have not been correctly permuted")
    if edged_curve.point(0) != geom.Point3D([7.5, 5.2, 6.3]):
        raise ValueError(
            "[Test] Point coordinates have not been correctly permuted")

    if edged_curve.edge_vertex(mesh.EdgeVertex(0, 0)) != 1:
        raise ValueError("[Test] Wrong EdgeVertex after vertex permute")
    if edged_curve.edge_vertex(mesh.EdgeVertex(0, 1)) != 3:
        raise ValueError("[Test] Wrong EdgeVertex after vertex permute")
    if edged_curve.edge_vertex(mesh.EdgeVertex(1, 0)) != 1:
        raise ValueError("[Test] Wrong EdgeVertex after vertex permute")
    if edged_curve.edge_vertex(mesh.EdgeVertex(1, 1)) != 0:
        raise ValueError("[Test] Wrong EdgeVertex after vertex permute")
    if edged_curve.edge_vertex(mesh.EdgeVertex(2, 0)) != 2:
        raise ValueError("[Test] Wrong EdgeVertex after vertex permute")
    if edged_curve.edge_vertex(mesh.EdgeVertex(2, 1)) != 0:
        raise ValueError("[Test] Wrong EdgeVertex after vertex permute")
    if edged_curve.edge_vertex(mesh.EdgeVertex(3, 0)) != 3:
        raise ValueError("[Test] Wrong EdgeVertex after vertex permute")
    if edged_curve.edge_vertex(mesh.EdgeVertex(3, 1)) != 0:
        raise ValueError("[Test] Wrong EdgeVertex after vertex permute")

    builder.permute_edges([1, 3, 0, 2])

    if edged_curve.edge_vertex(mesh.EdgeVertex(0, 0)) != 1:
        raise ValueError("[Test] Wrong EdgeVertex after edge permute")
    if edged_curve.edge_vertex(mesh.EdgeVertex(0, 1)) != 0:
        raise ValueError("[Test] Wrong EdgeVertex after edge permute")
    if edged_curve.edge_vertex(mesh.EdgeVertex(1, 0)) != 3:
        raise ValueError("[Test] Wrong EdgeVertex after edge permute")
    if edged_curve.edge_vertex(mesh.EdgeVertex(1, 1)) != 0:
        raise ValueError("[Test] Wrong EdgeVertex after edge permute")
    if edged_curve.edge_vertex(mesh.EdgeVertex(2, 0)) != 1:
        raise ValueError("[Test] Wrong EdgeVertex after edge permute")
    if edged_curve.edge_vertex(mesh.EdgeVertex(2, 1)) != 3:
        raise ValueError("[Test] Wrong EdgeVertex after edge permute")
    if edged_curve.edge_vertex(mesh.EdgeVertex(3, 0)) != 2:
        raise ValueError("[Test] Wrong EdgeVertex after edge permute")
    if edged_curve.edge_vertex(mesh.EdgeVertex(3, 1)) != 0:
        raise ValueError("[Test] Wrong EdgeVertex after edge permute")

    edges_around_1 = edged_curve.edges_around_vertex(1)
    if edges_around_1.size() != 2:
        raise ValueError("[Test] edges_around_1 should have 2 edges")
    if edges_around_1[0].edge_id != 2:
        raise ValueError("[Test] edges_around_1 has wrong value")
    if edges_around_1[0].vertex_id != 0:
        raise ValueError("[Test] edges_around_1 has wrong value")
    if edges_around_1[1].edge_id != 0:
        raise ValueError("[Test] edges_around_1 has wrong value")
    if edges_around_1[1].vertex_id != 0:
        raise ValueError("[Test] edges_around_1 has wrong value")

    edges_around_0 = edged_curve.edges_around_vertex(0)
    if edges_around_0.size() != 3:
        raise ValueError("[Test] edges_around_0 should have 3 edges")
    if edges_around_0[0].edge_id != 0:
        raise ValueError("[Test] edges_around_0 has wrong value")
    if edges_around_0[0].vertex_id != 1:
        raise ValueError("[Test] edges_around_0 has wrong value")
    if edges_around_0[1].edge_id != 3:
        raise ValueError("[Test] edges_around_0 has wrong value")
    if edges_around_0[1].vertex_id != 1:
        raise ValueError("[Test] edges_around_0 has wrong value")
    if edges_around_0[2].edge_id != 1:
        raise ValueError("[Test] edges_around_0 has wrong value")
    if edges_around_0[2].vertex_id != 1:
        raise ValueError("[Test] edges_around_0 has wrong value")