This module implements the substitution
associated with a one-dimensional substitution
,
that acts on unit faces of dimension
in
.
This module defines the following classes and functions:
See the documentation of these objects for more information.
The convention for the choice of the unit faces and the
definition of varies from article to article.
Here, unit faces are defined by
and the generalized substitution is defined by
where is the abelianized of
, and
is the matrix of
.
AUTHORS:
REFERENCES:
[AI] | P. Arnoux, S. Ito, Pisot substitutions and Rauzy fractals, Bull. Belg. Math. Soc. 8 (2), 2001, pp. 181–207 |
[AIS] | Y. Sano, P. Arnoux, S. Ito, Higher dimensional extensions of substitutions and their dual maps, J. Anal. Math. 83, 2001, pp. 183–206 |
EXAMPLES:
We start by drawing a simple three-face patch:
sage: from sage.combinat.e_one_star import E1Star, Face, Patch
sage: x = [Face((0,0,0),1), Face((0,0,0),2), Face((0,0,0),3)]
sage: P = Patch(x)
sage: P
Patch: [[(0, 0, 0), 1]*, [(0, 0, 0), 2]*, [(0, 0, 0), 3]*]
sage: P.plot() #not tested
We apply a substitution to this patch, and draw the result:
sage: sigma = WordMorphism({1:[1,2], 2:[1,3], 3:[1]})
sage: E = E1Star(sigma)
sage: E(P)
Patch: [[(1, 0, -1), 1]*, [(0, 1, -1), 2]*, [(0, 0, 0), 3]*, [(0, 0, 0), 1]*, [(0, 0, 0), 2]*]
sage: E(P).plot() #not tested
Note
sage: x = [Face((0,0,0),1), Face((0,0,0),2), Face((0,0,0),3)]
sage: P = Patch(x)
sage: sigma = WordMorphism({1:[1,2], 2:[1,3], 3:[1]})
sage: E = E1Star(sigma)
sage: E(P)
Patch: [[(1, 0, -1), 1]*, [(0, 1, -1), 2]*, [(0, 0, 0), 3]*, [(0, 0, 0), 1]*, [(0, 0, 0), 2]*]
We can also use the Patch method apply_substitution, which changes the patch:
sage: sigma = WordMorphism({1:[1,3,1], 2:[1], 3:[1,1,3,2]})
sage: E = E1Star(sigma)
sage: p = Patch([Face((0,0,0),t) for t in [1,2,3]])
sage: p.apply_substitution(E, 5)
sage: p
Patch of 723 faces
The application of an E1Star substitution assigns to each new face the color of its preimage. The repaint method allows us to repaint the faces of a patch. A single color can also be assigned to every face, by specifying a list of a single color:
sage: p = Patch([Face((0,0,0),t) for t in [1,2,3]])
sage: p.apply_substitution(E, 5)
sage: p.repaint(['green'])
sage: p.plot() #not tested
A list of colors allows us to color the faces sequentially:
sage: p = Patch([Face((0,0,0),t) for t in [1,2,3]])
sage: p.apply_substitution(E)
sage: p.repaint(['red', 'yellow', 'green', 'blue', 'black'])
sage: p.apply_substitution(E, 3)
sage: p.plot() #not tested
All the color schemes from matplotlib.cm.datad.keys() can be used:
sage: p = Patch([Face((0,0,0),t) for t in [1,2,3]])
sage: p.repaint(cmap='summer')
sage: p.apply_substitution(E, 3)
sage: p.plot() #not tested
sage: p.repaint(cmap='hsv')
sage: p.apply_substitution(E, 2)
sage: p.plot() #not tested
It is also possible to specify a dictionary to color the faces according to their type:
sage: p = Patch([Face((0,0,0),t) for t in [1,2,3]])
sage: p.apply_substitution(E, 5)
sage: p.repaint({1:(0.7, 0.7, 0.7), 2:(0.5,0.5,0.5), 3:(0.3,0.3,0.3)})
sage: p.plot() #not tested
sage: p.repaint({1:'red', 2:'yellow', 3:'green'})
sage: p.plot() #not tested
Let us look at a nice big patch in 3D:
sage: sigma = WordMorphism({1:[1,2], 2:[3], 3:[1]})
sage: E = E1Star(sigma)
sage: x = [Face((0,0,0),t) for t in [1,2,3]]
sage: P = Patch(x)
sage: P.add(P.translate([-1,1,0]))
sage: P.apply_substitution(E, 11)
sage: P.plot3d() #not tested
Plotting with TikZ pictures is possible:
sage: P = Patch([Face((0,0,0),t) for t in [1,2,3]])
sage: s = P.plot_tikz()
sage: print s
\begin{tikzpicture}
[x={(-0.216506cm,-0.125000cm)}, y={(0.216506cm,-0.125000cm)}, z={(0.000000cm,0.250000cm)}]
\definecolor{facecolor}{rgb}{1.000000,0.000000,0.000000}
\fill[fill=facecolor, draw=black, shift={(0,0,0)}]
(0, 0, 0) -- (0, 1, 0) -- (0, 1, 1) -- (0, 0, 1) -- cycle;
\definecolor{facecolor}{rgb}{0.000000,1.000000,0.000000}
\fill[fill=facecolor, draw=black, shift={(0,0,0)}]
(0, 0, 0) -- (0, 0, 1) -- (1, 0, 1) -- (1, 0, 0) -- cycle;
\definecolor{facecolor}{rgb}{0.000000,0.000000,1.000000}
\fill[fill=facecolor, draw=black, shift={(0,0,0)}]
(0, 0, 0) -- (1, 0, 0) -- (1, 1, 0) -- (0, 1, 0) -- cycle;
\end{tikzpicture}
Plotting patches made of unit segments instead of unit faces:
sage: P = Patch([Face([0,0], 1), Face([0,0], 2)])
sage: E = E1Star(WordMorphism({1:[1,2],2:[1]}))
sage: F = E1Star(WordMorphism({1:[1,1,2],2:[2,1]}))
sage: E(P,5).plot()
sage: F(P,3).plot()
Everything works in any dimension (except for the plotting features which only work in dimension two or three):
sage: x = [Face((0,0,0,0),1), Face((0,0,0,0),4)]
sage: P = Patch(x)
sage: sigma = WordMorphism({1:[1,2], 2:[1,3], 3:[1,4], 4:[1]})
sage: E = E1Star(sigma)
sage: E(P)
Patch: [[(1, 0, 0, -1), 1]*, [(0, 1, 0, -1), 2]*, [(0, 0, 1, -1), 3]*, [(0, 0, 0, 0), 4]*, [(0, 0, 0, 0), 3]*]
sage: sigma = WordMorphism({1:[1,2],2:[1,3],3:[1,4],4:[1,5],5:[1,6],6:[1,7],7:[1,8],8:[1,9],9:[1,10],10:[1,11],11:[1,12],12:[1]})
sage: E = E1Star(sigma)
sage: E
E_1^*(WordMorphism: 1->12, 10->1,11, 11->1,12, 12->1, 2->13, 3->14, 4->15, 5->16, 6->17, 7->18, 8->19, 9->1,10)
sage: P = Patch([Face((0,0,0,0,0,0,0,0,0,0,0,0),t) for t in [1,2,3]])
sage: for x in E(P): print x
[(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1), 1]*
[(0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1), 2]*
[(0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, -1), 3]*
[(0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, -1), 4]*
[(0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, -1), 5]*
[(0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, -1), 6]*
[(0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, -1), 7]*
[(0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, -1), 8]*
[(0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, -1), 9]*
[(0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, -1), 10]*
[(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, -1), 11]*
[(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), 12]*
[(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), 1]*
[(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), 2]*
Bases: sage.structure.sage_object.SageObject
A class to model the map associated with
a unimodular substitution
.
INPUT:
Note
The alphabet of the domain and the codomain of must be
equal, and they must be of the form [1, ..., d], where d
is a positive integer corresponding to the length of the vectors
of the faces on which
will act.
EXAMPLES:
sage: from sage.combinat.e_one_star import E1Star, Face, Patch
sage: P = Patch([Face((0,0,0),t) for t in [1,2,3]])
sage: sigma = WordMorphism({1:[1,2], 2:[1,3], 3:[1]})
sage: E = E1Star(sigma)
sage: E(P)
Patch: [[(1, 0, -1), 1]*, [(0, 1, -1), 2]*, [(0, 0, 0), 3]*, [(0, 0, 0), 1]*, [(0, 0, 0), 2]*]
sage: x = [Face((0,0,0,0),1), Face((0,0,0,0),4)]
sage: P = Patch(x)
sage: sigma = WordMorphism({1:[1,2], 2:[1,3], 3:[1,4], 4:[1]})
sage: E = E1Star(sigma)
sage: E(P)
Patch: [[(1, 0, 0, -1), 1]*, [(0, 1, 0, -1), 2]*, [(0, 0, 1, -1), 3]*, [(0, 0, 0, 0), 4]*, [(0, 0, 0, 0), 3]*]
Returns the inverse of the matrix associated with self.
EXAMPLES:
sage: from sage.combinat.e_one_star import E1Star, Face, Patch
sage: sigma = WordMorphism({1:[1,2], 2:[1,3], 3:[1]})
sage: E = E1Star(sigma)
sage: E.inverse_matrix()
[ 0 1 0]
[ 0 0 1]
[ 1 -1 -1]
Returns the matrix associated with self.
EXAMPLES:
sage: from sage.combinat.e_one_star import E1Star, Face, Patch
sage: sigma = WordMorphism({1:[1,2], 2:[1,3], 3:[1]})
sage: E = E1Star(sigma)
sage: E.matrix()
[1 1 1]
[1 0 0]
[0 1 0]
Returns the WordMorphism associated with self.
EXAMPLES:
sage: from sage.combinat.e_one_star import E1Star, Face, Patch
sage: sigma = WordMorphism({1:[1,2], 2:[1,3], 3:[1]})
sage: E = E1Star(sigma)
sage: print E.sigma()
WordMorphism: 1->12, 2->13, 3->1
Bases: sage.structure.sage_object.SageObject
A class to model a unit face of arbitrary dimension.
A unit face in dimension is represented by
a
-dimensional vector v and a type t in
.
The type of the face corresponds to the canonical unit vector
to which the face is orthogonal.
The optional color argument is used in plotting functions.
INPUT:
EXAMPLES:
sage: from sage.combinat.e_one_star import E1Star, Face, Patch
sage: f = Face((0,2,0), 3)
sage: f.vector()
(0, 2, 0)
sage: f.type()
3
sage: f = Face((0,2,0), 3, color=(0.5, 0.5, 0.5))
sage: f.color()
RGB color (0.5, 0.5, 0.5)
Returns or change the color of the face.
INPUT:
OUTPUT:
color
EXAMPLES:
sage: from sage.combinat.e_one_star import E1Star, Face, Patch
sage: f = Face((0,2,0), 3)
sage: f.color()
RGB color (0.0, 0.0, 1.0)
sage: f.color('red')
sage: f.color()
RGB color (1.0, 0.0, 0.0)
Returns the type of the face.
EXAMPLES:
sage: from sage.combinat.e_one_star import E1Star, Face, Patch
sage: f = Face((0,2,0), 3)
sage: f.type()
3
sage: f = Face((0,2,0), 3)
sage: f.type()
3
Return the vector of the face.
EXAMPLES:
sage: from sage.combinat.e_one_star import E1Star, Face, Patch
sage: f = Face((0,2,0), 3)
sage: f.vector()
(0, 2, 0)
Bases: sage.structure.sage_object.SageObject
A class to model a collection of faces.
INPUT:
EXAMPLES:
sage: from sage.combinat.e_one_star import E1Star, Face, Patch
sage: x = [Face((0,0,0),t) for t in [1,2,3]]
sage: P = Patch(x)
sage: P
Patch: [[(0, 0, 0), 1]*, [(0, 0, 0), 2]*, [(0, 0, 0), 3]*]
sage: face_contour = {}
sage: face_contour[1] = map(vector, [(0,0,0),(0,1,0),(0,1,1),(0,0,1)])
sage: face_contour[2] = map(vector, [(0,0,0),(0,0,1),(1,0,1),(1,0,0)])
sage: face_contour[3] = map(vector, [(0,0,0),(1,0,0),(1,1,0),(0,1,0)])
sage: Patch([Face((0,0,0),t) for t in [1,2,3]], face_contour=face_contour)
Patch: [[(0, 0, 0), 1]*, [(0, 0, 0), 2]*, [(0, 0, 0), 3]*]
Add a face or many faces to the patch. This changes the patch.
Note
The faces to be added are assumed to be distinct from those already in the patch. A face already in the patch will be added twice. No verification of unicity is done.
EXAMPLES:
sage: from sage.combinat.e_one_star import E1Star, Face, Patch
sage: x = [Face((0,0,0),t) for t in [1,2]]
sage: P = Patch(x)
sage: P
Patch: [[(0, 0, 0), 1]*, [(0, 0, 0), 2]*]
sage: P.add(Face((1,2,3), 3))
sage: P
Patch: [[(0, 0, 0), 1]*, [(0, 0, 0), 2]*, [(1, 2, 3), 3]*]
sage: P.add([Face((1,2,3), 3), Face((2,3,3), 2)])
sage: P
Patch: [[(0, 0, 0), 1]*, [(0, 0, 0), 2]*, [(1, 2, 3), 3]*, [(1, 2, 3), 3]*, [(2, 3, 3), 2]*]
Applies the substitution E on the patch.
The color of every new face in the image is given the same color as its preimage.
This changes self.
INPUT:
EXAMPLES:
sage: from sage.combinat.e_one_star import E1Star, Face, Patch
sage: sigma = WordMorphism({1:[1,2], 2:[1,3], 3:[1]})
sage: E = E1Star(sigma)
sage: p = Patch([Face((0,0,0),t) for t in [1,2,3]])
sage: p.apply_substitution(E)
sage: p.plot() #not tested
sage: x = (0,0,0)
sage: p = Patch([Face(x, 1, 'red'), Face(x, 2, 'yellow'), Face(x, 3, 'green')])
sage: p.apply_substitution(E, 4)
sage: p
Patch of 31 faces
sage: p.plot() #not tested
Returns a list of the faces that have type t.
INPUT:
EXAMPLES:
sage: from sage.combinat.e_one_star import E1Star, Face, Patch
sage: P = Patch([Face((0,0,0),1), Face((1,2,0),3), Face((1,2,0),1)])
sage: P.faces_of_type(1)
[[(0, 0, 0), 1]*, [(1, 2, 0), 1]*]
Returns a list of the faces whose vector is v.
INPUT:
EXAMPLES:
sage: from sage.combinat.e_one_star import E1Star, Face, Patch
sage: P = Patch([Face((0,0,0),1), Face((1,2,0),3), Face((1,2,0),1)])
sage: P.faces_of_vector([1,2,0])
[[(1, 2, 0), 3]*, [(1, 2, 0), 1]*]
Returns all positions at which other appears in self, that is, all vectors v such that set(other.translate(v)) <= set(self).
INPUT:
OUTPUT:
a list of vectors
EXAMPLES:
sage: from sage.combinat.e_one_star import Face, Patch, E1Star
sage: P = Patch([Face([0,0,0], 1), Face([0,0,0], 2), Face([0,0,0], 3)])
sage: Q = Patch([Face([0,0,0], 1), Face([0,0,0], 2)])
sage: P.occurrences_of(Q)
[(0, 0, 0)]
sage: Q = Q.translate([1,2,3])
sage: P.occurrences_of(Q)
[(-1, -2, -3)]
sage: E = E1Star(WordMorphism({1:[1,2], 2:[1,3], 3:[1]}))
sage: P = Patch([Face([0,0,0], 1), Face([0,0,0], 2), Face([0,0,0], 3)])
sage: P = E(P,4)
sage: Q = Patch([Face([0,0,0], 1), Face([0,0,0], 2)])
sage: P.occurrences_of(Q)
[(1, 1, -2), (1, 1, -3), (1, 0, -1), (0, 1, -1), (0, 0, 1), (0, 0, 0)]
Returns a 2D graphic object depicting the patch.
INPUT:
Warning
Plotting is implemented only for patches in two or three dimensions.
EXAMPLES:
sage: from sage.combinat.e_one_star import E1Star, Face, Patch
sage: P = Patch([Face((0,0,0),t) for t in [1,2,3]])
sage: P.plot() #not tested
sage: sigma = WordMorphism({1:[1,2], 2:[1,3], 3:[1]})
sage: E = E1Star(sigma)
sage: P = Patch([Face((0,0,0),t) for t in [1,2,3]])
sage: P.apply_substitution(E, 5)
sage: P.plot()
Plot with a different projection matrix:
sage: sigma = WordMorphism({1:[1,2], 2:[1,3], 3:[1]})
sage: E = E1Star(sigma)
sage: P = Patch([Face((0,0,0),t) for t in [1,2,3]])
sage: M = matrix(2, 3, [1,0,-1,0.3,1,-3])
sage: P.apply_substitution(E, 3)
sage: P.plot(projmat=M)
Plot patches made of unit segments:
sage: P = Patch([Face([0,0], 1), Face([0,0], 2)])
sage: E = E1Star(WordMorphism({1:[1,2],2:[1]}))
sage: F = E1Star(WordMorphism({1:[1,1,2],2:[2,1]}))
sage: E(P,5).plot()
sage: F(P,3).plot()
Returns a 3D graphics object depicting the patch.
Warning
3D plotting is implemented only for patches in three dimensions.
EXAMPLES:
sage: from sage.combinat.e_one_star import E1Star, Face, Patch
sage: P = Patch([Face((0,0,0),t) for t in [1,2,3]])
sage: P.plot3d() #not tested
sage: sigma = WordMorphism({1:[1,2], 2:[1,3], 3:[1]})
sage: E = E1Star(sigma)
sage: P = Patch([Face((0,0,0),t) for t in [1,2,3]])
sage: P.apply_substitution(E, 5)
sage: P.repaint()
sage: P.plot3d() #not tested
Returns a string containing some TikZ code to be included into a LaTeX document, depicting the patch.
Warning
Tikz Plotting is implemented only for patches in three dimensions.
INPUT:
EXAMPLES:
sage: from sage.combinat.e_one_star import E1Star, Face, Patch
sage: P = Patch([Face((0,0,0),t) for t in [1,2,3]])
sage: s = P.plot_tikz()
sage: print s
\begin{tikzpicture}
[x={(-0.216506cm,-0.125000cm)}, y={(0.216506cm,-0.125000cm)}, z={(0.000000cm,0.250000cm)}]
\definecolor{facecolor}{rgb}{1.000000,0.000000,0.000000}
\fill[fill=facecolor, draw=black, shift={(0,0,0)}]
(0, 0, 0) -- (0, 1, 0) -- (0, 1, 1) -- (0, 0, 1) -- cycle;
\definecolor{facecolor}{rgb}{0.000000,1.000000,0.000000}
\fill[fill=facecolor, draw=black, shift={(0,0,0)}]
(0, 0, 0) -- (0, 0, 1) -- (1, 0, 1) -- (1, 0, 0) -- cycle;
\definecolor{facecolor}{rgb}{0.000000,0.000000,1.000000}
\fill[fill=facecolor, draw=black, shift={(0,0,0)}]
(0, 0, 0) -- (1, 0, 0) -- (1, 1, 0) -- (0, 1, 0) -- cycle;
\end{tikzpicture}
sage: sigma = WordMorphism({1:[1,2], 2:[1,3], 3:[1]})
sage: E = E1Star(sigma)
sage: P = Patch([Face((0,0,0),t) for t in [1,2,3]])
sage: P.apply_substitution(E, 4)
sage: from sage.misc.latex import latex #not tested
sage: latex.add_to_preamble('\\usepackage{tikz}') #not tested
sage: view(P, tightpage=true) #not tested
Plot using shades of gray (useful for article figures):
sage: sigma = WordMorphism({1:[1,2], 2:[1,3], 3:[1]})
sage: E = E1Star(sigma)
sage: P = Patch([Face((0,0,0),t) for t in [1,2,3]])
sage: P.repaint([(0.9, 0.9, 0.9), (0.65,0.65,0.65), (0.4,0.4,0.4)])
sage: P.apply_substitution(E, 4)
sage: P
Patch of 31 faces
sage: s = P.plot_tikz()
Plotting with various options:
sage: sigma = WordMorphism({1:[1,2], 2:[1,3], 3:[1]})
sage: E = E1Star(sigma)
sage: P = Patch([Face((0,0,0),t) for t in [1,2,3]])
sage: M = matrix(2, 3, map(float, [1,0,-0.7071,0,1,-0.7071]))
sage: P.apply_substitution(E, 3)
sage: s = P.plot_tikz(projmat=M, edgecolor='facecolor', scale=0.6, drawzero=True)
Adding X, Y, Z axes using the extra code feature:
sage: length = 1.5
sage: space = 0.3
sage: axes = ''
sage: axes += "\\draw[->, thick, black] (0,0,0) -- (%s, 0, 0);\n" % length
sage: axes += "\\draw[->, thick, black] (0,0,0) -- (0, %s, 0);\n" % length
sage: axes += "\\node at (%s,0,0) {$x$};\n" % (length + space)
sage: axes += "\\node at (0,%s,0) {$y$};\n" % (length + space)
sage: axes += "\\node at (0,0,%s) {$z$};\n" % (length + space)
sage: axes += "\\draw[->, thick, black] (0,0,0) -- (0, 0, %s);\n" % length
sage: cube = Patch([Face((0,0,0),1), Face((0,0,0),2), Face((0,0,0),3)])
sage: options = dict(scale=0.5,drawzero=True,extra_code_before=axes)
sage: r = cube.plot_tikz(**options)
sage: len(r)
1013
sage: print r
\begin{tikzpicture}
[x={(-0.433013cm,-0.250000cm)}, y={(0.433013cm,-0.250000cm)}, z={(0.000000cm,0.500000cm)}]
\draw[->, thick, black] (0,0,0) -- (1.50000000000000, 0, 0);
\draw[->, thick, black] (0,0,0) -- (0, 1.50000000000000, 0);
\node at (1.80000000000000,0,0) {$x$};
\node at (0,1.80000000000000,0) {$y$};
\node at (0,0,1.80000000000000) {$z$};
\draw[->, thick, black] (0,0,0) -- (0, 0, 1.50000000000000);
\definecolor{facecolor}{rgb}{1.000000,0.000000,0.000000}
\fill[fill=facecolor, draw=black, shift={(0,0,0)}]
(0, 0, 0) -- (0, 1, 0) -- (0, 1, 1) -- (0, 0, 1) -- cycle;
\definecolor{facecolor}{rgb}{0.000000,1.000000,0.000000}
\fill[fill=facecolor, draw=black, shift={(0,0,0)}]
(0, 0, 0) -- (0, 0, 1) -- (1, 0, 1) -- (1, 0, 0) -- cycle;
\definecolor{facecolor}{rgb}{0.000000,0.000000,1.000000}
\fill[fill=facecolor, draw=black, shift={(0,0,0)}]
(0, 0, 0) -- (1, 0, 0) -- (1, 1, 0) -- (0, 1, 0) -- cycle;
\node[circle,fill=black,draw=black,minimum size=1.5mm,inner sep=0pt] at (0,0,0) {};
\end{tikzpicture}
Repaints all the faces of self from the given color map.
This changes self.
INPUT:
EXAMPLES:
Using a color map:
sage: from sage.combinat.e_one_star import E1Star, Face, Patch
sage: color = (0, 0, 0)
sage: p = Patch([Face((0,0,0),t,color) for t in [1,2,3]])
sage: for f in p: f.color()
RGB color (0.0, 0.0, 0.0)
RGB color (0.0, 0.0, 0.0)
RGB color (0.0, 0.0, 0.0)
sage: p.repaint()
sage: p[1].color()
RGB color (0.498..., 0.432..., 0.522...)
Using a list of colors:
sage: p = Patch([Face((0,0,0),t,color) for t in [1,2,3]])
sage: p.repaint([(0.9, 0.9, 0.9), (0.65,0.65,0.65), (0.4,0.4,0.4)])
sage: for f in p: f.color()
RGB color (0.9000..., 0.9000..., 0.9000...)
RGB color (0.6500..., 0.6500..., 0.6500...)
RGB color (0.4000..., 0.4000..., 0.4000...)
Using a dictionary to color faces according to their type:
sage: p = Patch([Face((0,0,0),t) for t in [1,2,3]])
sage: p.repaint({1:'black', 2:'yellow', 3:'green'})
sage: p.plot() #not tested
sage: p.repaint({})
sage: p.plot() #not tested
Translates all the faces by the vector v.
This does not change self. It returns a copy.
INPUT:
OUTPUT:
a Patch
EXAMPLES:
sage: from sage.combinat.e_one_star import E1Star, Face, Patch
sage: P = Patch([Face((0,0,0),1), Face((1,2,0),3), Face((1,2,0),1)])
sage: P.translate([-1,-2,0])
Patch: [[(-1, -2, 0), 1]*, [(0, 0, 0), 3]*, [(0, 0, 0), 1]*]