Beispiel #1
0
def anim(coxeter_diagram,
         trunc_type,
         description="polyhedra",
         snub=False,
         extra_relations=()):
    """Call POV-Ray to render the frames and FFmpeg to generate the movie.
    """
    coxeter_matrix = helpers.fill_matrix(
        [x.numerator for x in coxeter_diagram])
    mirrors = helpers.get_mirrors(coxeter_diagram)

    if snub:
        P = Snub(coxeter_matrix, mirrors, trunc_type)
    else:
        P = Polyhedra(coxeter_matrix, mirrors, trunc_type, extra_relations)

    P.build_geometry()
    write_to_pov(P)

    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"))

    subprocess.call(FFMPEG_COMMAND.format(description, description),
                    shell=True)
def draw(coxeter_diagram,
         trunc_type,
         description="polychora",
         extra_relations=(),
         **kwargs):
    coxeter_matrix = helpers.fill_matrix(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"))
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)
Beispiel #4
0
def render_star_polyhedra(coxeter_diagram,
                          trunc_type,
                          extra_relations=(),
                          render_file="star-polyhedra.pov",
                          output=None):
    coxeter_matrix = helpers.fill_matrix([x.numerator for x in coxeter_diagram])
    mirrors = helpers.get_mirrors(coxeter_diagram)
    P = models.Polyhedra(coxeter_matrix, mirrors, trunc_type, extra_relations)
    _render_model(P, render_file, output)
Beispiel #5
0
 def __init__(self):
     coxeter_diagram = (3, 2, 2, 3, 3, 2)
     coxeter_matrix = helpers.fill_matrix(coxeter_diagram)
     mirrors = helpers.get_mirrors(coxeter_diagram)
     super().__init__(coxeter_matrix, mirrors, (1, 1, 1, 1), extra_relations=())
     self.symmetry_gens = tuple(range(6))
     self.symmetry_rels = ((0,) * 3, (2,) * 3, (4,) * 3,
                           (0, 2) * 2, (0, 4) * 2, (3, 4) * 2,
                           (0, 1), (2, 3), (4, 5))
     self.rotations = ((0,), (2,), (4,), (0, 2), (0, 4), (3, 4))
Beispiel #6
0
def render_polychora(coxeter_diagram,
                     trunc_type,
                     render_file,
                     output=None):
    """
    The main entrance for rendering 4d polychora.
    """
    coxeter_matrix = helpers.fill_matrix(coxeter_diagram)
    mirrors = helpers.get_mirrors(coxeter_diagram)
    P = models.Polychora(coxeter_matrix, mirrors, trunc_type)
    _render_model(P, render_file, output)
Beispiel #7
0
def render_polyhedra(coxeter_diagram,
                     trunc_type,
                     render_file="polyhedra.pov",
                     output=None,
                     snub=False):
    """
    The main entrance for rendering 3d polyhedra.
    """
    coxeter_matrix = helpers.fill_matrix(coxeter_diagram)
    mirrors = helpers.get_mirrors(coxeter_diagram)
    if snub:
        P = models.Snub(coxeter_matrix, mirrors, trunc_type)
    else:
        P = models.Polyhedra(coxeter_matrix, mirrors, trunc_type)

    _render_model(P, render_file, output)
Beispiel #8
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.
    """
    coxeter_matrix = helpers.fill_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, 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)