Archive for September, 2008

Booleans as Function Parameters Considered Harmful

Let’s start with a quick quiz. What do the following completely made-up lines of code do?: thing.SetIsVisible( true ); thing.SetVisibile( true ); var item = factory.CreateThing( true ); Although they’re made-up, they could just as easily not be. When you jump into someone else’s code for the first time, all the code might as well [...]

A Quick C# Teaser

Look at the following C# code, and work out why it compiles: namespace X { class Foo { void Bar() { http://www.hackification.com System.Console.WriteLine(); } } } (Hint: it’s not an error, but it is a warning.) Idea originally from here. Oh – and please, please, please – don’t even think about using this as an [...]

Experiments in Ray-Tracing, Part 9: Interpolation

In this article I’m going to present a technique that trades lower image quality for faster rendering time: interpolation. Instead of ray-tracing every single pixel, we instead start by tracing pixels in an evenly-spaced grid, say every two or four pixels. (So if we have an interpolation step of two, we trace one out of [...]