Histograms everywhere #
Up until now I've only been computing a simple histogram, the distribution of inner angles for all points in the stroke. Based on the ideas in the Shape Distributions paper, I have been adding more types. Although their focus is on 3D model searching, it is generally applicable to my 2D stroke work as well (for once, instead of leaving the extension of a 2D algorithm into 3D as "an exercise for the reader", I get to instead simplify a 3D algorithm down to 2D).
Several shape functions that can be used to generate signatures are described in the paper. The ones that I chose as being relevant/interesting are A3 (angle between three random points), D2 (distance between two random points) and D3 (square root of the area between three random points). In order to do this sampling randomly and still have it exhibit as little variance as possible, they pick 1024 * 1024 points, bin them into 1024 buckets and then sample the resulting histogram into a curve with 64 points. I currently only pick ten thousand points that I just leave into a histogram with 100 buckets. Generating the histogram repeatedly shows some visible variance, so I may have to bump up these numbers. There is also the issue that I do all this sampling at the stroke points (after the stroke has been resampled and normalized for position/size). By comparison, the paper does all sampling randomly. The net effect is that I get periodic spikes because of the even spacing between points. May or may not be desirable.
Also on the topic of histograms, I've polished their appearance a bit. The Tufte-inspired look makes them a bit more readable, and the labels help when you've got 4 histograms per stroke and several strokes on the screen.
This was actually part of a general UI cleanup that I did on Sunday, as a way of procrastinating from real work. Initially I had wanted to add tabs to GLUI, so that I could more easily (and intuitively) toggle between the different modes that Thor supports (importing, querying, viewing of basic shapes). Unfortunately GLUI's codebase is pretty decrepit (in addition to having an indentation scheme that I completely disagree with) and so that plan was soon dropped. Instead, I settled for having a mode menu which hides/show the relevant pane(s) of controls. GLUI doesn't support hiding and showing of controls per se, but adding that was relatively easy since the functionality is effectively implemented by rollouts.
Post a Comment