CS798 - Assignment 1
This assignment dealt with symmetry groups. The programming component dealt with celtic knotwork. Given a file containing grid size, and location of break markers, we were required to process the file and output a postscript file of the knotwork associated with such a grid and it's break markers. I quickly realized, while handling the sample input files, that I wanted to create a GUI to make working with the knotwork easier.
I utterly and entirely confess to the application being based off of the CS488 Assignment 1, which I'd completed some few days earlier. The UI uses gtkmm, with OpenGL and C++. There is a command line interface which works, but it's so much nicer to be able to see what's going on. In anycase, I started out with making a basic grid to play on. We were told in class that it really comes down to 5 different types of squares, with rotations. Well, I found 4 squares, and a blank, which I suppose is a type of square, it just seems like a cop-out. I made some basic polygons (as my initial attempt at meshes/nurbs was bust), and created an array to store all the information pertaining to a particular cube. By the time I remembered I like taking pictures/screenshots, I'd already implemented file loading, the grid, and the splines.
The UI comes in 3 different display modes: Grid, which shows the basic grid layout, and the positioning of the break markers; Splines, which can be slightly hard to look at - it has a basic outline of the knot, with the grid in the background; and lastly Knots, which is the final render product. I eventually looked at my graphics text to discover some convienient ways (glMesh1d or thereabouts) to make a nice looking spline. When I discovered that this transfers nicely over to 2d, I was elated.
I must admit, I had a hard time figuring out how to get the over lap to work. Originally I begin just drawing with an overlap being physically brought out (via a z translation). However, playing around had me realize only 2 shapes under go overlap, and even then, only in particular squares, and under particular rotations. Once I got that all smoothly sorted out (*heh* a graphics pun), I was set to go for getting it all interactive.
I lie. Actually I tried to get selection to work. When I first was thinking about being able to select break markers to be on/off, I thought it'll be a mathematically 'fun' reverse rendering, and there'll be matrices and horribleness. So when I finally got around to it, somehow (I can't remember how) I came across the fact that OpenGL has a mechanism for picking objects within a scene. The first 20 times I tried it, nothing was getting picked. The next 20 times I tried it, the wrong things were getting picked. So I distracted myself, and got exports to scaled vector graphics (ie. postscript) to work.
By the time the export was all happily done, I was ready to tackle picking again (more ever re-inforced by discovering text describing picking in my course notes, and recognizing I'll be needing to know it for CS488 A3). Through 4 different webpages, course notes, and a text book, I was finally able to sort out exactly how picking is supposed to work. Dear goodness. No fancy tricks, not hiddens whatevers. Just straight out reproduction of the scene (approximately). Blah. So once I had that done, and some bugs on break marker selection fixed, I was recognizing I wouldn't be getting much fanciness done (outside of the UI). I'd been hoping for importing a 3d object, and coating it in celtic knots - hence keeping the rotation ability from CS488 A1. I also really wanted to animate the knot work to make it look like snakes inter-twining.
The UI allows for loading files (specially encoded to store grid size, break marker position, and my own modification - colour values), saving files, and exporting files to postscript. As well, one can start from scratch by specifying a grid size.
By default, mouse click/drag rotates the grid space (or knot - whatever's currently being displayed). Holding down "shift" allows for translations (x, y, z). These can be returned to a default position through a reset function. There exists a break marker mode which allows for the user to interactively select which break markers should be on and off for the knot selection.
Finally, there are settings for what the curve fill colour should be, what the border colour should be, and what over/under pattern should be displayed (ie. it's a standard symmetry to swap all over knots with under knots, and vice versa). If I were really on the ball, I'd have allowed for border width, and knot width to be modifable. It's not though.
Some Sample Knotwork
As a part of the assignment, we were to export our images to SVG output. Unfortunately, I didn't add wide enough borders, so the overlapping component is hard to identify. I've uploaded 5 examples here, as well as the title page image.
Tiling P2-11:
Tiling P111:
Tiling P112:
Tiling P121:
Tiling P222
Title Page Graphic:





