|
50 | 50 | } |
51 | 51 |
|
52 | 52 | # Pattern selection - change this value to use a different pattern |
| 53 | + |
53 | 54 | PATTERN_TYPE = 15 |
54 | 55 |
|
55 | 56 | # ============================================================================== |
56 | 57 | # Input geometry: 3D Mesh |
57 | 58 | # ============================================================================== |
58 | 59 |
|
59 | | -# mesh = Mesh.from_obj(Path(__file__).parent.parent.parent / "data" / "minimal_surface.obj") |
60 | 60 | mesh = Mesh.from_off(Path(__file__).parent.parent.parent / "data" / "beetle.off") |
61 | | -for key, attr in mesh.vertices(True): |
62 | | - y = attr["y"] |
63 | | - attr["y"] = -attr["z"] |
64 | | - attr["z"] = y |
| 61 | + |
| 62 | +for vertex in mesh.vertices(): |
| 63 | + x, y, z = mesh.vertex_attributes(vertex, "xyz") # type: ignore |
| 64 | + mesh.vertex_attributes(vertex, "xyz", [x, -z, y]) |
| 65 | + |
65 | 66 | mesh.translate([2, 2, 0.5]) |
66 | 67 |
|
67 | 68 | v, f = mesh.to_vertices_and_faces() |
|
108 | 109 | config.camera.position = [5, 2, 1.5] |
109 | 110 |
|
110 | 111 | viewer = Viewer(config=config) |
| 112 | + |
111 | 113 | viewer.scene.add(mesh, name="mesh", show_faces=False, linecolor=Color.grey(), opacity=0.2) |
112 | 114 | viewer.scene.add(Mesh.from_vertices_and_faces(pv, pf), name="pattern2d") |
113 | 115 | viewer.scene.add(mesh_mapped, name="mesh_mapped", facecolor=Color.red()) |
|
0 commit comments