示例#1
0
 def test_parse_build_halfedge_off(self, cube_off_mesh):
     with open("tests/data/faces_test.off") as faces:
         vertices = [halfedge_mesh.Vertex(-1, -1, -1, i) for i in range(3)]
         f, e = cube_off_mesh.parse_build_halfedge_off(faces, 1, vertices)
         assert len(f) == 1
         assert f[0].a == 0 and f[0].b == 1 and f[0].c == 2
         assert f[0].index == 0
         assert len(e) == 3
示例#2
0
    def test_vertices_in_facet(self, cube_off_mesh):
        halfedge = cube_off_mesh.facets[0].halfedge

        vertices = set([
            halfedge_mesh.Vertex(1.0, -1.0, 1.0, 1),
            halfedge_mesh.Vertex(1.0, -1.0, -1.0, 0),
            halfedge_mesh.Vertex(-1.0, -1.0, 1.0, 2)
        ])

        # make sure all vertices are in the facet described by halfedge
        assert halfedge.vertex in vertices
        vertices.remove(halfedge.vertex)

        assert halfedge.next.vertex in vertices
        vertices.discard(halfedge.next.vertex)

        assert halfedge.next.next.vertex in vertices
        vertices.discard(halfedge.next.next.vertex)
示例#3
0
    def test_halfedgemesh_vertices_are_in_order_with_cubeoff(
            self, cube_off_mesh):
        # Tests parse_off since Vertex is just a basic class
        vertices = cube_off_mesh.vertices

        # cube vertices in order
        pts = [
            1, -1, -1, 1, -1, 1, -1, -1, 1, -1, -1, -1, 1, 1, -0.999999,
            0.999999, 1, 1.000001
        ]

        count = 0
        for index in range(0, len(vertices), 3):
            # Vertex(a,b,c, index)
            assert vertices[count] == halfedge_mesh.Vertex(
                pts[index], pts[index + 1], pts[index + 2], count)
            count += 1
示例#4
0
 def test_get_vertex(self, cube_off_mesh):
     mesh_vertex = cube_off_mesh.vertices[0].get_vertex()
     test_vertex = halfedge_mesh.Vertex(1, -1, -1, 0).get_vertex()
     assert halfedge_mesh.allclose(mesh_vertex, test_vertex)