Wednesday, February 20, 2013


I'm not really going to do an LCARS - type GUI for my new XBee software.  Well, probably not!  In fact, especially since I learned you can put a Cocoa wrapper around a Java program, in a way that makes it possible to even do with Processing (or you could just grow up a little and learn to use standard Java)....

Oh, yes.  I downloaded the latest XCode/developer environment from Apple.  I think the last time I messed with I got to "Hello World" but gave up on actually linking to useful libraries.  Maybe this time I'll get further.

In any case, I spent time today learning how to make LCARS shapes in Processing.  Which wasn't as frivolous an exercise as it seems.  First off was finding out about the LINE and BEZIER classes.  And, unfortunately, although lines and lines with rounded ends are a natural for Processing, the LCARS "Sweep" -- a curve that goes through 90 degrees and from thick to thin -- can't be done with those simple tools.

I graphed out an LCARS sweep and plotted it in vertex by vertex; that worked, but besides being non-scalable annoyed me as a long-way-round way of doing it.  More careful investigation showed the LCARS sweep is basically two filled circles; one positive, one negative.

Ah, but the trick is to write this stack of shapes once, and reference it as needed within the program.  This also makes it easier to dynamically change the display!  So the next thing to learn was PShapes; a class that wraps various sorts of geometry to allow it to be manipulated more easily within the Processing window.

Except PShapes didn't seem to give me the instancing I wanted to selectively modify the shapes I called up from the template.  Either that or I wasn't understanding how to properly use it.  The answer was obvious -- it just took me most of the evening, a full mug of coffee and a lot of Bach to get through it.

Object-oriented programming.  I had to actually sit down and make my first full-fledged class.  Not a function I referenced from elsewhere, but a class that could be instanced to objects with methods that could be called on a per-object basis.

And that's done and I feel a little more like a proper beginning porgammer///progerammer//pregoram/////guy who writes code.  Now I just have to refine my understanding of inheritance................

Oh; this has nothing to do with the British television series Z-Cars.  Which happened to include in the original cast a young BRIAN BLESSED.

Pity they never had a uniformed PC on that show named Gordon.  Who would be, you know, ALIIIVE!

No comments:

Post a Comment