def __init__(self, coxeter_diagram, init_dist): if len(coxeter_diagram) != 6 or len(init_dist) != 4: raise ValueError("Invalid input dimension") # Coxeter matrix and its rank self.cox_mat = helpers.make_symmetry_matrix(coxeter_diagram) self.rank = len(self.cox_mat) # generators of the symmetry group self.gens = tuple(range(self.rank)) # symmetry group of this tiling self.G = CoxeterGroup(self.cox_mat) # a mirror is active iff the initial point is not on it self.active = tuple(bool(x) for x in init_dist) # reflection mirrors self.mirrors = self.get_mirrors(coxeter_diagram) # reflections (possibly affine) about the mirrors self.reflections = self.get_reflections() # coordinates of the initial point self.init_v = self.get_init_point(init_dist) self.edge_hash_set = set() self.num_vertices = 0 self.num_edges = 0
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"))
def __init__(self, pqr, init_dist): self.active = [bool(x) for x in init_dist] self.cox_mat = helpers.make_symmetry_matrix(pqr) self.dfa = automata.get_automaton(self.cox_mat) self.mirrors = self.get_mirrors(self.cox_mat) self.init_v = helpers.get_init_point(self.mirrors, init_dist) self.reflections = self.get_reflections(self.mirrors, init_dist) self.fundamental_faces = []
def main(): coxeter_diagram = (5, 2, 2, 3, 2, 3) coxeter_matrix = helpers.make_symmetry_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)
def __init__(self): coxeter_diagram = (3, 2, 2, 3, 3, 2) coxeter_matrix = helpers.make_symmetry_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))
def __init__(self, pqr, init_dist): if helpers.get_geometry_type(pqr) != 0: raise ValueError("The triple (p, q, r) must satisfy 1/p+1/q+1/r=1") self.active = [bool(x) for x in init_dist] self.cox_mat = helpers.make_symmetry_matrix(pqr) self.dfa = get_automaton(self.cox_mat) self.mirrors = self.get_mirrors(self.cox_mat) self.init_v = helpers.get_init_point(self.mirrors, init_dist) self.reflections = self.get_reflections(self.mirrors, init_dist) self.fundamental_faces = []
def __init__(self, coxeter_diagram, init_dist): if len(coxeter_diagram) != 3 or len(init_dist) != 3: raise ValueError("Invalid input dimension") self.diagram = coxeter_diagram # Coxeter matrix and its rank self.cox_mat = helpers.make_symmetry_matrix(coxeter_diagram) self.rank = len(self.cox_mat) # generators of the symmetry group self.gens = tuple(range(self.rank)) # symmetry group of this tiling self.G = CoxeterGroup(self.cox_mat) # a mirror is active iff the initial point is not on it self.active = tuple(bool(x) for x in init_dist) # reflection mirrors self.mirrors = self.get_mirrors(coxeter_diagram) # reflections (possibly affine) about the mirrors self.reflections = self.get_reflections() # coordinates of the initial point self.init_v = self.get_init_point(init_dist) # vertices of the fundamental triangle self.triangle_verts = self.get_fundamental_triangle_verts() # ---------------------- # to be calculated later # ---------------------- # holds the words in the symmetry group up to a given depth self.words = None # holds the coset representatives of the standard parabolic # subgroup of vertex-stabilizing subgroup self.vwords = None self.vertices_coords = [] self.num_vertices = None self.num_edges = None self.num_faces = None self.edge_indices = {} self.face_indices = {}
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.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, 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)
def anim(coxeter_diagram, trunc_type, description="polyhedra", snub=False, catalan=False, extra_relations=()): """Call POV-Ray to render the frames and FFmpeg to generate the movie. """ coxeter_matrix = helpers.make_symmetry_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) if catalan: P = Catalan3D(P) 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)
alpha = np.pi / r beta = np.pi / q cosa = np.cos(alpha) sina = np.sin(alpha) sinb = np.sin(beta) vAC = cosa + sina * 1j vBC = -np.cos(beta) + sinb * 1j rAC = 1 / (vAC - sina / sinb * vBC) C = rAC * vAC return A, B, C p, q, r = 6, 2, 3 # the tiling active = (1, 1, 1) # active mirrors depth = 80 # draw tiles with their shortlex word representations up to length 50 cox_mat = helpers.make_symmetry_matrix(p, q, r) # Coxeter matrix A, B, C = get_euclidean_fundamental_triangle(p, q, r) # fundamental triangle dfa = automata.get_automaton(cox_mat) # the dfa of the Coxeter group v0 = helpers.from_bary_coords([A, B, C], active) # initial vertex edges = [[B, C], [A, C], [A, B]] # i-th edge must be opposite to the i-th vertex in [A, B, C]. reflections = [helpers.reflection_by_line(*e) for e in edges] # three reflections def get_fundamental_faces(): faces = [] for i, j in combinations(range(3), 2): f0 = [] P = v0