Beispiel #1
0
def unit_cell_geometry(ortho, xy_plane_only=False):
    g = jvx.geometry("unit_cell")
    points_int = jvx.pointSet()
    points_cart = g.points
    points_cart.hide_points()
    for i in (0, 1):
        for j in (0, 1):
            for k in (0, 1):
                if xy_plane_only and k != 0:
                    continue
                v = (i, j, k)
                points_int.append(v)
                points_cart.append(ortho(v))
    lines = g.lines
    for i in xrange(0, len(points_int.points) - 1):
        for j in xrange(i + 1, len(points_int.points)):
            v1 = points_int.points[i].vertex
            v2 = points_int.points[j].vertex
            n = 0
            for k in xrange(3):
                if v1[k] != v2[k]:
                    n += 1
            if n == 1:
                lines.append(jvx.line((i, j)))
    return g
Beispiel #2
0
def edge_geometry(ortho, all_edge_segments, shrink_length, xy_plane_only=False):
    g = jvx.geometry("edges")
    g.points.hide_points()
    g.lines = jvx.lineSet(thickness=3)
    for edge_segments in all_edge_segments:
        for i_segment in xrange(len(edge_segments) - 1):
            v1, v2 = [edge_segments[i_segment + _].vertex for _ in [0, 1]]
            if xy_plane_only and (v1[2] != 0 or v2[2] != 0):
                continue
            i = g.points.size()
            g.points.extend(shrink_edge(ortho(v1), ortho(v2), shrink_length))
            g.lines.append(jvx.line((i, i + 1), color=select_color(edge_segments[i_segment].edge_inclusive_flag)))
    return g
Beispiel #3
0
def basis_vector_geometry(ortho, min_fractional):
    g = jvx.geometry("basis_vectors")
    g.points.hide_points()
    g.lines = jvx.lineSet(thickness=3)
    for i in xrange(3):
        v = [float(x) - 0.15 for x in min_fractional]
        if (i == 0):
            g.points.append(ortho(v))
        v[i] += 0.25
        g.points.append(ortho(v))
    for i in xrange(3):
        color = [0, 0, 0]
        color[i] = 255
        g.lines.append(jvx.line(vertices=(0, i + 1), color=color))
    return g
Beispiel #4
0
def basis_vector_geometry(ortho, min_fractional):
    g = jvx.geometry("basis_vectors")
    g.points.hide_points()
    g.lines = jvx.lineSet(thickness=3)
    for i in xrange(3):
        v = [float(x) - 0.15 for x in min_fractional]
        if i == 0:
            g.points.append(ortho(v))
        v[i] += 0.25
        g.points.append(ortho(v))
    for i in xrange(3):
        color = [0, 0, 0]
        color[i] = 255
        g.lines.append(jvx.line(vertices=(0, i + 1), color=color))
    return g
Beispiel #5
0
def edge_geometry(ortho,
                  all_edge_segments,
                  shrink_length,
                  xy_plane_only=False):
    g = jvx.geometry("edges")
    g.points.hide_points()
    g.lines = jvx.lineSet(thickness=3)
    for edge_segments in all_edge_segments:
        for i_segment in xrange(len(edge_segments) - 1):
            v1, v2 = [edge_segments[i_segment + _].vertex for _ in [0, 1]]
            if (xy_plane_only and (v1[2] != 0 or v2[2] != 0)):
                continue
            i = g.points.size()
            g.points.extend(shrink_edge(ortho(v1), ortho(v2), shrink_length))
            g.lines.append(
                jvx.line((i, i + 1),
                         color=select_color(
                             edge_segments[i_segment].edge_inclusive_flag)))
    return g
Beispiel #6
0
def unit_cell_geometry(ortho, xy_plane_only=False):
    g = jvx.geometry("unit_cell")
    points_int = jvx.pointSet()
    points_cart = g.points
    points_cart.hide_points()
    for i in (0, 1):
        for j in (0, 1):
            for k in (0, 1):
                if (xy_plane_only and k != 0): continue
                v = (i, j, k)
                points_int.append(v)
                points_cart.append(ortho(v))
    lines = g.lines
    for i in xrange(0, len(points_int.points) - 1):
        for j in xrange(i + 1, len(points_int.points)):
            v1 = points_int.points[i].vertex
            v2 = points_int.points[j].vertex
            n = 0
            for k in xrange(3):
                if (v1[k] != v2[k]): n += 1
            if (n == 1):
                lines.append(jvx.line((i, j)))
    return g