コード例 #1
0
vertexcolor = {
    key: (255, 0, 0)
    for key in shell.vertices_where({'is_anchor': True})
}

lines = []
for key in shell.vertices():
    a = shell.vertex_coordinates(key)
    n = shell.vertex_normal(key)
    b = add_vectors(a, n)

    lines.append({
        'start': a,
        'end': b,
        'arrow': 'end',
        'color': (0, 255, 0),
        'name': "{}.{}.normal".format(shell.name, key)
    })

# ==============================================================================
# Visualise
# ==============================================================================

artist = ShellArtist(shell, layer="Geometry::Normals")
artist.clear_layer()
artist.draw_vertices(color=vertexcolor)
artist.draw_edges()
artist.draw_lines(lines)
artist.redraw()
コード例 #2
0
#     path = os.path.join(DATA, 'FABRIC', 'unrolled', SIDE, "{}.json".format(mesh.attributes['name']))
#     mesh.to_json(path)

# for mesh in NW_unrolled:
#     path = os.path.join(DATA, 'FABRIC', 'unrolled', SIDE, "{}.json".format(mesh.attributes['name']))
#     mesh.to_json(path)

# ==============================================================================
# Visualize
# ==============================================================================

ARTIST = ShellArtist(None)

for mesh in SOUTH_unrolled:
    points = [
        mesh.vertex_coordinates(key)
        for key in mesh.vertices_on_boundary(ordered=True)
    ]
    polygon = offset_polygon(points, SEEM)
    polygons = [{'points': polygon + polygon[:1]}]

    ARTIST.mesh = mesh
    ARTIST.layer = "Unrolled::{}::{}".format(SIDE, mesh.attributes['name'])
    ARTIST.clear_layer()
    ARTIST.draw_faces()
    ARTIST.draw_facelabels(text={
        key: "{}".format(attr['count'])
        for key, attr in mesh.faces(True)
    })
    ARTIST.draw_polygons(polygons)