for my $i (0..$#pos) {
my $differs = $track->[$i] != $last;
$last = $track->[$i];
+ next unless $differs;
o(" $prepline\n");
o(" gsave ",
psvec($pos[$i] + mkvec(-0.0 * $token_sz, $dy/2))," translate\n");
o(" 12 -22 moveto ($track->[$i]) show");
o(" grestore\n");
}
- if ($differs || $i==-1) {
- if ($i > 0) {
- o(" 0 -$dy moveto",
- " ",psvec(mkvec( $dx + $cube_sz, 0 )),
- " rlineto stroke\n");
- }
- o(" ",($token_sz * 0.6 + $cube_gap)," ",
- (-$dy * 0.5 - 0.5 * (water_cubes_sz(2))),
- " translate\n");
- my $bottom = int(($track->[$i+1] + 1) / 2);
- water_cubes($bottom);
- my $new_n = $track->[$i+1] - $bottom;
- o(" ", 0.5 * (water_cubes_sz($bottom) - water_cubes_sz($new_n)),
- " ", (water_cubes_sz(2)-water_cubes_sz(1)), " translate\n");
- water_cubes($new_n);
+ if ($i > 0) {
+ o(" 0 -$dy moveto",
+ " ",psvec(mkvec( $dx + $cube_sz, 0 )),
+ " rlineto stroke\n");
}
+ o(" ",($token_sz * 0.6 + $cube_gap)," ",
+ (-$dy * 0.5 - 0.5 * (water_cubes_sz(2))),
+ " translate\n");
+ my $bottom = int(($track->[$i+1] + 1) / 2);
+ water_cubes($bottom);
+ my $new_n = $track->[$i+1] - $bottom;
+ o(" ", 0.5 * (water_cubes_sz($bottom) - water_cubes_sz($new_n)),
+ " ", (water_cubes_sz(2)-water_cubes_sz(1)), " translate\n");
+ water_cubes($new_n);
o(" grestore\n");
}
o(" grestore\n");