|
From: <arj...@us...> - 2009-01-02 12:22:25
|
Revision: 9246
http://plplot.svn.sourceforge.net/plplot/?rev=9246&view=rev
Author: arjenmarkus
Date: 2009-01-02 11:43:47 +0000 (Fri, 02 Jan 2009)
Log Message:
-----------
Corrected examples x11 and x13: x11 now gives a few rounding differences only,
x13 gives a perfect match (at least on Windows)
Modified Paths:
--------------
trunk/examples/tcl/x11.tcl
trunk/examples/tcl/x13.tcl
Modified: trunk/examples/tcl/x11.tcl
===================================================================
--- trunk/examples/tcl/x11.tcl 2009-01-02 11:42:13 UTC (rev 9245)
+++ trunk/examples/tcl/x11.tcl 2009-01-02 11:43:47 UTC (rev 9246)
@@ -8,10 +8,10 @@
# Routine for restoring colour map1 to default.
# See static void plcmap1_def(void) in plctrl.c for reference.
proc restore_cmap1_11 {w} {
- # For center control points, pick black or white, whichever is closer to bg
+ # For center control points, pick black or white, whichever is closer to bg
# Be careful to pick just short of top or bottom else hue info is lost
$w cmd plgcolbg rbg gbg bbg
- set vertex [expr ($rbg + $gbg + $bbg)/(3.*255.)]
+ set vertex [expr {($rbg + $gbg + $bbg)/(3.*255.)}]
if {$vertex < 0.5} {
set vertex 0.01
set midpt 0.10
@@ -62,7 +62,7 @@
# Integer flag array is zero (no interpolation along far-side of colour
# figure
matrix rev i 2 = {0, 0}
- # Number of cmap1 colours is 256 in this case.
+ # Number of cmap1 colours is 256 in this case.
$w cmd plscmap1n 256
# Interpolate between control points to set up default cmap1.
$w cmd plscmap1l 0 2 i h l s rev
@@ -77,9 +77,9 @@
set DRAW_LINEXY 3
set MAG_COLOR 0x04
set BASE_CONT 0x08
- matrix opt i 4 = "$DRAW_LINEXY, $DRAW_LINEXY"
- matrix alt f 4 = {33.0, 17.0}
- matrix az f 4 = {24.0, 115.0}
+ matrix opt i 2 = "$DRAW_LINEXY, $DRAW_LINEXY"
+ matrix alt f 2 = {33.0, 17.0}
+ matrix az f 2 = {24.0, 115.0}
set xpts 35
set ypts 46
@@ -89,33 +89,33 @@
matrix z f $xpts $ypts
for {set i 0} {$i < $xpts} {incr i} {
- x $i = [expr 3.* ($i - ($xpts/2)) / double($xpts/2) ]
+ x $i = [expr {3.* ($i - ($xpts/2)) / double($xpts/2)} ]
}
for {set i 0} {$i < $ypts} {incr i} {
- y $i = [expr 3.* ($i - ($ypts/2)) / double($ypts/2) ]
+ y $i = [expr {3.* ($i - ($ypts/2)) / double($ypts/2)} ]
}
for {set i 0} {$i < $xpts} {incr i} {
set xx [x $i]
for {set j 0} {$j < $ypts} {incr j} {
set yy [y $j]
- z $i $j = [expr 3. * (1.-$xx)*(1.-$xx) * exp(-($xx*$xx) - \
+ z $i $j = [expr {3. * (1.-$xx)*(1.-$xx) * exp(-($xx*$xx) - \
($yy+1.)*($yy+1.)) - 10. * ($xx/5. - pow($xx,3.) - \
pow($yy,5.)) * exp(-$xx*$xx-$yy*$yy) - \
- 1./3. * exp(-($xx+1)*($xx+1) - ($yy*$yy))]
- # Jungfraujoch/Interlaken
+ 1./3. * exp(-($xx+1)*($xx+1) - ($yy*$yy))}]
+ # Jungfraujoch/Interlaken
if {1==2} {
set zz [z $i $j]
if {$zz <= -1.} {
- z $i $j = [expr -1]
+ z $i $j = -1.0
}
}
}
}
- set zmin [z min [ expr $xpts * $ypts]]
- set zmax [z max [ expr $xpts * $ypts]]
+ set zmin [z min [ expr {$xpts * $ypts}]]
+ set zmax [z max [ expr {$xpts * $ypts}]]
set nlev 10
matrix clev f $nlev
@@ -141,20 +141,20 @@
# wireframe plot
if {$i == 0} {
- $w cmd plmesh x y z [expr [opt $k]]
+ $w cmd plmesh x y z [expr {[opt $k]}]
# magnitude colored wireframe plot
} elseif {$i == 1} {
- $w cmd plmesh x y z [expr [opt $k] | $MAG_COLOR]
+ $w cmd plmesh x y z [expr {[opt $k] | $MAG_COLOR}]
# magnitude colored wireframe plot with sides
} elseif {$i == 2} {
- $w cmd plot3d x y z [expr [opt $k] | $MAG_COLOR] 1
+ $w cmd plot3d x y z [expr {[opt $k] | $MAG_COLOR}] 1
# magnitude colored wireframe plot with base contour
} elseif {$i == 3} {
$w cmd plmeshc x y z $xpts $ypts \
- [expr [opt $k] | $MAG_COLOR | $BASE_CONT] clev $nlev
+ [expr {[opt $k] | $MAG_COLOR | $BASE_CONT}] clev $nlev
}
$w cmd plcol0 3
Modified: trunk/examples/tcl/x13.tcl
===================================================================
--- trunk/examples/tcl/x13.tcl 2009-01-02 11:42:13 UTC (rev 9245)
+++ trunk/examples/tcl/x13.tcl 2009-01-02 11:43:47 UTC (rev 9246)
@@ -22,49 +22,51 @@
$w cmd pladv 0
$w cmd plvasp 1.
- $w cmd plwind 0. 10. 0. 10.
+ $w cmd plwind 0. 10. 0. 10.
# $w cmd plenv 0. 10. 0. 10. 1 -2
$w cmd plcol0 2
- set theta0 0.;
+ set theta0 0.
set pi 3.14159265358979323846
- set dthet [expr 2. * $pi / 500.]
+ set factor [expr {2. * $pi / 500.}]
+ set dthet 1.0
for {set i 0} {$i <= 4} {incr i} {
- set j 0;
- x $j = 5.;
- y $j = 5.;
+ set j 0
+ x $j = 5.
+ y $j = 5.
incr j
- set theta1 [expr $theta0 + 2. * $pi * [per $i] / 100.]
+ set theta1 [expr {$theta0 + 5.0 * [per $i]}]
if {$i == 4} {
- set theta1 [expr 2. * $pi]
+ set theta1 500.0
}
for {set theta $theta0} {$theta <= $theta1} {
- set theta [expr $theta + $dthet]} {
- x $j = [expr 5. + 3. * cos($theta) ]
- y $j = [expr 5. + 3. * sin($theta) ]
+ set theta [expr {$theta + $dthet}]} {
+ x $j = [expr {5. + 3. * cos($factor*$theta)} ]
+ y $j = [expr {5. + 3. * sin($factor*$theta)} ]
incr j
}
- $w cmd plcol0 [expr $i + 1]
- $w cmd plpsty [expr (($i + 3) % 8 + 1)]
+ $w cmd plcol0 [expr {$i + 1}]
+ $w cmd plpsty [expr {(($i + 3) % 8 + 1)}]
$w cmd plfill $j x y
$w cmd plcol0 1
$w cmd plline $j x y
- set just [expr ($theta0 + $theta1) / 2.]
- set dx [expr .25 * cos($just)]
- set dy [expr .25 * sin($just)]
- if {$just < $pi / 2. || $just > 3. * $pi / 2.} {
+ set just [expr {$factor * ($theta0 + $theta1) / 2.}]
+ set dx [expr {.25 * cos($just)}]
+ set dy [expr {.25 * sin($just)}]
+ if { ($theta0 + $theta1) < 250.0 || ($theta0 + $theta1) > 750.0 } {
set just 0.
} else {
set just 1.
}
- $w cmd plptex [expr [x [expr $j / 2]] + $dx] \
- [expr [y [expr $j / 2]] + $dy] 1.0 0.0 $just [set text$i]
- set theta0 [expr $theta - $dthet]
+ set halfj [expr {$j/2}]
+ $w cmd plptex [expr {[x $halfj] + $dx}] \
+ [expr {[y $halfj] + $dy}] 1.0 0.0 $just [set text$i]
+ set theta0 [expr {$theta - $dthet}]
}
$w cmd plfont 2
$w cmd plschr 0. 1.3
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|