Making pictures with math

Today, for a virtual reality project we are doing, a student asked me if there was a good way to arrange dots around a sphere in a nice random way. This student isn’t a math or computer science student, but he has been taking my computer graphics class, where we focus on how math can describe visual things.

So I felt confident that I could just describe to him, in a few words, a good approach: Instead of picking dots on a sphere, pick dots inside the cube that surrounds the sphere. This is easier, because you can just pick the dot’s x, y and z coordinates independently.

Then if any dot you pick falls outside the sphere, just throw it out and try again. So now you’ve got a collection of random dots that happen to all be inside the sphere. Now all you have to do is push all those points out to the sphere’s surface, and you’re done.

The cool thing was that this was all I needed to tell him. He totally understood it, got why it worked, and started coding it then and there. The other eight or so students around the table also got it, and none of them were math or computer science majors.

And they all seemed very interested when I said that the technique I’d just described was a well known technique in math called the “Monte Carlo method”. It’s called that because you basically keep rolling the dice like you’re in a gambling casino, but then you get to decide which rolls of the dice you want to keep.

I love the fact that a group of students who think of themselves as artists, animators and designers are comfortable with this way of thinking about visual things. “Making pictures with math” may just be catching on.

Leave a Reply