Interesting about OS X Jonathan. I'd never noticed it specifically before, but thinking about it I know exactly what you're talking about. Height does suggest importance, but to my mind one line to explain a line is a good importance rating. If it needs an explanation surely it's important enough for some height then. (Or maybe that's just circular thinking?) And again, if it's important enough to rate a comment, some extra spacing around it to differentiate is probably worth it so that you can find it again quickly later. It's probably all just personal preference. Something like this I think of as normal:
Code: Select all
// get the colors from the pre-calculated color matrix
$height_index = colorIndex($image, $coloring[$c][$d]);
// override in case of special items in landscape
if (isset($contents[$c][$d][0]))
{
if ($contents[$c][$d][0] == 1)
$height_index = $gray;
else if ($contents[$c][$d][0] == 2)
$height_index = $waterblue;
else if ($contents[$c][$d][0] == 3)
$height_index = $sandyellow;
}
Code: Select all
$averageY0 = $average + $bHeight + 5 * $scale * cos($angle/180 * M_PI); // back
$averageY1 = $average + $bHeight - 5 * $scale * sin($angle/180 * M_PI); // on the right
$averageY2 = $average + $bHeight + 5 * $scale * sin($angle/180 * M_PI); // on the left
$averageY3 = $average + $bHeight - 5 * $scale * cos($angle/180 * M_PI); // front
Hurrah! Here's something that's recently written and has a crap variable name!
Code: Select all
// 2 consecutive vertical pixels
t = ((float)data[d*x + line] + (float)data[(d - 1)*x + line]) / 2.0f;
Which is why I guess I have such fun gems lying around:
Code: Select all
boolean dead = false;
dead = selfCollide(dt);
dead = dead | collide(grid.getWalls(), dt, false);
for (int j = 0; j < grid.getPlayers().size() && !dead; j++) {
Cycle player = ((Cycle) grid.getPlayers().get(j));
if (id != player.getId() && !player.isDead()) {
dead = dead | collide(player.getWalls(), dt, true);
}
}
Comments are good, however you do them. That or write dead obvious code.