# create some layers and groups
layers = {
"Squares": svg.layer(label="Squares"),
+ "Backfaces": svg.layer(label="Backfaces"),
"Tetraflexagon": svg.layer(label="Tetraflexagon"),
"Template": svg.layer(label="Template")
}
fill_color=(0.5, 0.5, 0.5, 0.2))
self.backend.active_group = old_active_group
- self.backend.active_group = old_active_group
-
# Draw the normal template for squares
for square in self.tetraflexagon.squares:
self.draw_square_template(square)
ref['clip-path'] = "url(%s)" % (tile_href + '-clip-path')
group.add(ref)
+ # A tri-tetraflexagon only have one visible backface, the first one.
+ group = self.groups["Backfaces"]
+ for tile in self.tetraflexagon.squares[0].tiles:
+ m = self.get_backface_tile_transform(tile)
+ svg_matrix = "matrix(%f, %f, %f, %f, %f, %f)" % (m[0], m[3],
+ m[1], m[4],
+ m[2], m[5])
+ tile_href = "#square0-tile%d" % tile.index
+ ref = self.backend.svg.use("#square0-content")
+ ref['transform'] = svg_matrix
+ ref['clip-path'] = "url(%s)" % (tile_href + '-clip-path')
+ group.add(ref)
+
def draw_tile_template(self, tile, cx, cy, theta):
old_active_group = self.backend.active_group
group_name = "square%d-tile%d" % (tile.square.index, tile.index)
super(SvgwriteTetraflexagonDiagram, self).draw_tile_template(tile, cx, cy, theta)
- # The tile outline in the active group's element is the only polygon
+ # The tile outline in the active group's element is the only rectangle
# element, so get it and set its id so that it can be reused as
# a clip-path
for element in self.backend.active_group.elements:
self.backend.active_group = old_active_group
+
def main():
width = 3508
height = 2480