+ # draw the backfaces
+ group = self.groups["Backfaces"]
+ for hexagon in self.hexaflexagon.hexagons:
+ for triangle in hexagon.triangles:
+ m = self.get_triangle_backfaces_transform(triangle)
+ svg_matrix = "matrix(%f, %f, %f, %f, %f, %f)" % (m[0], m[3],
+ m[1], m[4],
+ m[2], m[5])
+
+ triangle_href = "#hexagon%d-triangle%d" % (hexagon.index, triangle.index)
+
+ # Reuse the content to draw the backface
+ content_href = "#hexagon%d-content" % hexagon.index
+ ref = self.backend.svg.use(content_href)
+ ref['transform'] = svg_matrix
+ ref['clip-path'] = "url(%s)" % (triangle_href + '-clip-path')
+ group.add(ref)
+