OpenGLot

As a teaching tool for a course last semester, I put together an interactive plotter in openGL which I endearingly named “openGLot.” (For those who missed it, “openGL” + “plot” = “openGLot.”) See, I felt like I had to give it a very unsavory name so that if it ever became widely used, people would be forced to use its ill-sounding moniker.

At any rate, I originally wrote in Ruby, but have been slowly porting it to C++ with high hopes for its use and applicability. I still have a bunch of interactive demos for numerical methods (from Newton’s method to the trapezoidal rule for numerical integration) in the Ruby version, but I’ll be bringing those to the C++ version one of these days. I started a sourceforge project for it a while ago, which was kind of exciting.

At any rate, as a brief (albeit nerdy) respite from the academic onslaught today, I added a class for parameterized curves.

A demo of a parameterized curve in openGLot

A demo of a parameterized curve in openGLot

I’ve got a bunch more primitives to add to it (scalar and vector fields, for example), but those will surely come one of these days. I’ve added adaptive mesh refinement (so that “busier” functions require more sampling to get a more accurate visual representation), but I’m still not quite happy with it.

A "busy" function with no adaptive refinement

A "busy" function with no adaptive refinement

The same "busy" function with recursive refinement.

The same "busy" function with recursive refinement.

I’ve also got a 3D version, but that’s not been polished or formalized, but everyone loves a pretty graph:
openGLot3D

Tagged with:
 

Graphing

For Scientific Computing, I decided I wanted to have a grapher with which I could programmatically interface easily. Of course, there are options other there, from gnuPlot to you-name-it, but I figured that it wouldn’t be too hard to write one myself. Especially since there’s a ruby port for OpenGL.

Long story short, I’ve got something that’s not too terrible. Not perfect, but it’s certainly a start:

A few functions plotted with my grapher

A few functions plotted with my grapher

But then, I thought, “why stop there?” I figured it wouldn’t be that hard to make a 3D version. While the 2D one will work on any generic function you give it, this 3D one has it hard-coded in right now. Of course, it wouldn’t be too much more to make it more flexible, but given that this took 30 minutes, I’m ok with its rigidity.

A simple surface.

A simple surface.

We’ll see where this goes. It makes me feel a little nerdy that I’m two days into my winter break, and this is how I’ve spent some of it.

Tagged with: