def draw(coxeter_diagram,
         trunc_type,
         description="polychora",
         extra_relations=(),
         **kwargs):
    coxeter_matrix = helpers.make_symmetry_matrix(
        [x.numerator for x in coxeter_diagram])
    mirrors = helpers.get_mirrors(coxeter_diagram)
    P = Polychora(coxeter_matrix, mirrors, trunc_type, extra_relations)
    P.build_geometry()
    write_to_pov(P, **kwargs)

    print("rendering {} with {} vertices, {} edges, {} faces".format(
        description, P.num_vertices, P.num_edges, P.num_faces))

    process = subprocess.Popen(POV_COMMAND.format(description),
                               shell=True,
                               stderr=subprocess.PIPE,
                               stdin=subprocess.PIPE,
                               stdout=subprocess.PIPE)

    _, err = process.communicate()
    if process.returncode:
        print(type(err), err)
        raise IOError("POVRay error: " + err.decode("ascii"))
Exemplo n.º 2
0
def main():
    coxeter_diagram = (5, 2, 2, 3, 2, 3)
    coxeter_matrix = helpers.fill_matrix(coxeter_diagram)
    mirrors = helpers.get_mirrors(coxeter_diagram)
    P = Polychora(coxeter_matrix, mirrors, (1, 0, 0, 0))
    P.build_geometry()
    write_to_pov(P)
    subprocess.call(POV_COMMAND, shell=True)
Exemplo n.º 3
0
def anim(coxeter_diagram,
         trunc_type,
         description="polychora-rotation4d",
         glass_tex="NBglass",
         face_index=0,
         vertex_color="SkyBlue",
         edge_color="Orange",
         extra_relations=()):
    """Call POV-Ray to render the frames and FFmpeg to generate the movie.
    """
    P = Polychora(coxeter_diagram, trunc_type, extra_relations)
    P.build_geometry()
    write_to_pov(P, glass_tex, face_index, vertex_color, edge_color)
    subprocess.call(POV_COMMAND.format(description), shell=True)
    subprocess.call(FFMPEG_COMMAND.format(description, description),
                    shell=True)
Exemplo n.º 4
0
def main():
    coxeter_diagram = (5, 2, 2, 3, 2, 3)
    P = Polychora(coxeter_diagram, (1, 0, 0, 0))
    P.build_geometry()
    write_to_pov(P)
    subprocess.call(POV_COMMAND, shell=True)