Wednesday, November 30, 2016

On the Road to Splines 2

After a bit of work this evening, I managed to implement the nonuniform splines as described in Game Programming Gems 4 Chapter 2.4. "Nonuniform Splines" by Thomas Lowe presents three times of pleasantly-rounded splines, the rounded nonuniform spline, the smooth nonuniform spline, and the timed nonuniform spline.  While I implemented the code for all three splines in my drawing program, only the rounded nonuniform spline is actually available through the GUI.

A rounded nonuniform spline

As you can see, it is a relatively-smooth shape, despite the fact that I've turned it into line segments roughly ten pixels long each.  A second spline is shown below, selected so that the end points of the line segments are visible.

A spline selected.  The green circles represent the end points of the line segments.
I've sorted out in my head the concepts on the topological graph vs. the shapes.  I've thought through how to do serialize the shapes and substances into simple XML.  I'm also thinking up other ways to utilize this.  There are several published articles on terrain and other feature generation using lines, splines, polygons, etc. and I've thought up several variants, as well.  The function graphs from several weeks back were related to one of those ideas.

So what's next, in the immediate future?  The polyline with curved corners, and making the edit mode display the vertices as drawn, rather that the line segment vertices.  Pan and zoom, too.  Then comes the real work, with the substances/layers.  Road, rail, river, etc.  Stay tuned for more.

No comments:

Post a Comment