## [PyX-devel] [PATCH 2/3] manual, graph.style.surface: Fix a striking typo

 [PyX-devel] [PATCH 2/3] manual, graph.style.surface: Fix a striking typo From: Michael J Gruber - 2010-06-22 09:10:57 ```Lightning is what strikes before thunder roars, lighting is the shading created by light sources. Signed-off-by: Michael J Gruber --- manual/graph.tex | 4 ++-- pyx/graph/style.py | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/manual/graph.tex b/manual/graph.tex index 54f903f..897e4bf 100644 --- a/manual/graph.tex +++ b/manual/graph.tex @@ -1052,10 +1052,10 @@ definition is: maximal values, but larger bounds could be set). If no \var{colorname} column exists, the surface style falls back - to a lightning coloring taking into account the angle between the + to a lighting coloring taking into account the angle between the view ray and the triangle and the distance between viewer and triangle. The precise conversion is defined in the - \method{lightning} method. + \method{lighting} method. If a \var{gridcolor} is set, the rectangular grid is marked by small stripes of the relative (compared to each rectangle) size of diff --git a/pyx/graph/style.py b/pyx/graph/style.py index 562b3e7..b484297 100644 --- a/pyx/graph/style.py +++ b/pyx/graph/style.py @@ -1688,7 +1688,7 @@ class surface(_style): def midcolor(self, c1, c2, c3, c4): return 0.25*(c1+c2+c3+c4) - def lightning(self, angle, zindex): + def lighting(self, angle, zindex): if angle < 0 and self.backcolor is not None: return self.backcolor return self.gradient.getcolor(0.7-0.4*abs(angle)+0.1*zindex) @@ -1822,10 +1822,10 @@ class surface(_style): c4d = c3d = c5d = self.backcolor else: zindex = graph.vzindex(*v5) - c1a = c2a = c5a = self.lightning(sign*graph.vangle(*(v1+v2+v5)), zindex) - c3b = c1b = c5b = self.lightning(sign*graph.vangle(*(v3+v1+v5)), zindex) - c2c = c4c = c5c = self.lightning(sign*graph.vangle(*(v2+v4+v5)), zindex) - c4d = c3d = c5d = self.lightning(sign*graph.vangle(*(v4+v3+v5)), zindex) + c1a = c2a = c5a = self.lighting(sign*graph.vangle(*(v1+v2+v5)), zindex) + c3b = c1b = c5b = self.lighting(sign*graph.vangle(*(v3+v1+v5)), zindex) + c2c = c4c = c5c = self.lighting(sign*graph.vangle(*(v2+v4+v5)), zindex) + c4d = c3d = c5d = self.lighting(sign*graph.vangle(*(v4+v3+v5)), zindex) for zindex, i in sortElements: if i == 0: elements.append(mesh.element((mesh.node_pt((x1_pt, y1_pt), c1a), -- 1.7.1.621.g01d76 ```

 [PyX-devel] [PATCH 0/3] Some clean-up for graph.style.surface From: Michael J Gruber - 2010-06-22 09:10:54 ```Here are a few suggested clean-ups which I came acros when re-learning graph.style.surface. The first two are typo fixes. The last one fixes the mincolor/maxcolor argument handling. I don't know (or remember) whether you guys like git style patches, prefer inline or attachments, so please tell me whatever is appropriate. Michael J Gruber (3): manual: colorname names the color column manual,graph.style.surface: Fix a striking typo graph.style.surface: Make mincolor and maxcolor work manual/graph.tex | 8 ++++---- pyx/graph/style.py | 15 ++++++++------- 2 files changed, 12 insertions(+), 11 deletions(-) ```
 [PyX-devel] [PATCH 1/3] manual: colorname names the color column From: Michael J Gruber - 2010-06-22 09:10:55 ```The name of the color column argument is colorname, not columnname. Signed-off-by: Michael J Gruber --- manual/graph.tex | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/manual/graph.tex b/manual/graph.tex index c0099fc..54f903f 100644 --- a/manual/graph.tex +++ b/manual/graph.tex @@ -1047,11 +1047,11 @@ definition is: into 4 triangles. The grid can be colored using values provided by the data column - named \var{columnname}. The values are rescaled to the range [0:1] + named \var{colorname}. The values are rescaled to the range [0:1] using mincolor and maxcolor (which are taken from the minimal and maximal values, but larger bounds could be set). - If no \var{columnname} column exists, the surface style falls back + If no \var{colorname} column exists, the surface style falls back to a lightning coloring taking into account the angle between the view ray and the triangle and the distance between viewer and triangle. The precise conversion is defined in the -- 1.7.1.621.g01d76 ```
 [PyX-devel] [PATCH 2/3] manual, graph.style.surface: Fix a striking typo From: Michael J Gruber - 2010-06-22 09:10:57 ```Lightning is what strikes before thunder roars, lighting is the shading created by light sources. Signed-off-by: Michael J Gruber --- manual/graph.tex | 4 ++-- pyx/graph/style.py | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/manual/graph.tex b/manual/graph.tex index 54f903f..897e4bf 100644 --- a/manual/graph.tex +++ b/manual/graph.tex @@ -1052,10 +1052,10 @@ definition is: maximal values, but larger bounds could be set). If no \var{colorname} column exists, the surface style falls back - to a lightning coloring taking into account the angle between the + to a lighting coloring taking into account the angle between the view ray and the triangle and the distance between viewer and triangle. The precise conversion is defined in the - \method{lightning} method. + \method{lighting} method. If a \var{gridcolor} is set, the rectangular grid is marked by small stripes of the relative (compared to each rectangle) size of diff --git a/pyx/graph/style.py b/pyx/graph/style.py index 562b3e7..b484297 100644 --- a/pyx/graph/style.py +++ b/pyx/graph/style.py @@ -1688,7 +1688,7 @@ class surface(_style): def midcolor(self, c1, c2, c3, c4): return 0.25*(c1+c2+c3+c4) - def lightning(self, angle, zindex): + def lighting(self, angle, zindex): if angle < 0 and self.backcolor is not None: return self.backcolor return self.gradient.getcolor(0.7-0.4*abs(angle)+0.1*zindex) @@ -1822,10 +1822,10 @@ class surface(_style): c4d = c3d = c5d = self.backcolor else: zindex = graph.vzindex(*v5) - c1a = c2a = c5a = self.lightning(sign*graph.vangle(*(v1+v2+v5)), zindex) - c3b = c1b = c5b = self.lightning(sign*graph.vangle(*(v3+v1+v5)), zindex) - c2c = c4c = c5c = self.lightning(sign*graph.vangle(*(v2+v4+v5)), zindex) - c4d = c3d = c5d = self.lightning(sign*graph.vangle(*(v4+v3+v5)), zindex) + c1a = c2a = c5a = self.lighting(sign*graph.vangle(*(v1+v2+v5)), zindex) + c3b = c1b = c5b = self.lighting(sign*graph.vangle(*(v3+v1+v5)), zindex) + c2c = c4c = c5c = self.lighting(sign*graph.vangle(*(v2+v4+v5)), zindex) + c4d = c3d = c5d = self.lighting(sign*graph.vangle(*(v4+v3+v5)), zindex) for zindex, i in sortElements: if i == 0: elements.append(mesh.element((mesh.node_pt((x1_pt, y1_pt), c1a), -- 1.7.1.621.g01d76 ```
 [PyX-devel] [PATCH 3/3] graph.style.surface: Make mincolor and maxcolor work From: Michael J Gruber - 2010-06-22 09:11:01 ```Currently, the mincolor and maxcolor arguments to surface are plainly ignored. Make them work as described, i.e. overriding the default coming from the actual range of values of the color column. In particular, this makes it possible to draw a surface with a single color without raising a division by zero. Also, make sure that actual color values are cut off at the forced min and max. Signed-off-by: Michael J Gruber --- pyx/graph/style.py | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pyx/graph/style.py b/pyx/graph/style.py index b484297..6860b09 100644 --- a/pyx/graph/style.py +++ b/pyx/graph/style.py @@ -1758,6 +1758,7 @@ class surface(_style): sortElements = [(zindex, i) for i, zindex in enumerate(sortElements)] sortElements.sort() + mincolor, maxcolor = privatedata.mincolor, privatedata.maxcolor if self.mincolor is not None: mincolor = self.mincolor if self.maxcolor is not None: @@ -1800,8 +1801,8 @@ class surface(_style): x5_pt, y5_pt = graph.vpos_pt(*v5) if privatedata.colorize: def colorfromgradient(c): - return self.gradient.getcolor((c - privatedata.mincolor) / - float(privatedata.maxcolor - privatedata.mincolor)) + return self.gradient.getcolor(min(1.0,max(0.0,(c - mincolor) / + float(maxcolor - mincolor)))) c1 = privatedata.colors[value1a][value2a] c2 = privatedata.colors[value1a][value2b] c3 = privatedata.colors[value1b][value2a] -- 1.7.1.621.g01d76 ```
 Re: [PyX-devel] [PATCH 0/3] Some clean-up for graph.style.surface From: André Wobst - 2010-06-24 05:47:26 Attachments: smime.p7s ```Dear Michael, I just finished applying your patches (I looked that the last yesterday during some travel, as I did not like this min-max-style of range restriction too much). Patches are in general fine. As long as everybody is happy with svn and patches are rare, I don't have any problem with it. Alternatively we might switch to git or hg in the future, if this would help the (very slow) development. Best, André Am 22.06.2010 um 11:10 schrieb Michael J Gruber: > Here are a few suggested clean-ups which I came acros when re-learning > graph.style.surface. The first two are typo fixes. The last one fixes the > mincolor/maxcolor argument handling. > > I don't know (or remember) whether you guys like git style patches, prefer > inline or attachments, so please tell me whatever is appropriate. > > Michael J Gruber (3): > manual: colorname names the color column > manual,graph.style.surface: Fix a striking typo > graph.style.surface: Make mincolor and maxcolor work > > manual/graph.tex | 8 ++++---- > pyx/graph/style.py | 15 ++++++++------- > 2 files changed, 12 insertions(+), 11 deletions(-) > > > ------------------------------------------------------------------------------ > ThinkGeek and WIRED's GeekDad team up for the Ultimate > GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the > lucky parental unit. See the prize list and enter to win: > http://p.sf.net/sfu/thinkgeek-promo > _______________________________________________ > PyX-devel mailing list > PyX-devel@... > https://lists.sourceforge.net/lists/listinfo/pyx-devel -- by _ _ _ Dr. André Wobst, Amselweg 22, 85716 Unterschleißheim / \ \ / ) wobsta@..., http://www.wobsta.de/ / _ \ \/\/ / PyX - High quality PostScript and PDF figures (_/ \_)_/\_/ with Python & TeX: visit http://pyx.sourceforge.net/ ```
 Re: [PyX-devel] [PATCH 0/3] Some clean-up for graph.style.surface From: Michael J Gruber - 2010-06-25 12:04:29 ```André Wobst venit, vidit, dixit 24.06.2010 07:46: > Dear Michael, > > I just finished applying your patches (I looked that the last > yesterday during some travel, as I did not like this min-max-style of > range restriction too much). > > Patches are in general fine. As long as everybody is happy with svn > and patches are rare, I don't have any problem with it. Alternatively > we might switch to git or hg in the future, if this would help the > (very slow) development. Hi André, I'm fine with git-svn, aka "guerilla git" ;) Speaking of which - I've set up a Git conversion of PyX's svn code at http://repo.or.cz/w/PyX.git which I maintain manually. I tried to make it clear that it's an "unofficial mirror" but consists of "official code" only. This is almost a straight conversion with standard layout (trunk, branches, tags) ignoring the superfluous "pyx" level beneath (root still has pyx, manual, etc., of course). The "tag branches" are converted into proper tag objects, preserving author, name and message of the "tag branch creating" commit. Please let me know if you want me to change something here. My own modifications live in a fork (http://repo.or.cz/w/PyX/mjg.git). Cheers, Michael ```