Path: utzoo!attcan!uunet!bloom-beacon!think!ames!dlb!ardent!ez!sleat From: sleat@ez.ardent.com (Michael Sleator) Newsgroups: comp.graphics Subject: Re: Cleaning up freehand drawings Message-ID: <8387@ardent.UUCP> Date: 23 Sep 89 02:39:34 GMT References: <1580002@hp-ptp.HP.COM> Sender: news@ardent.UUCP Reply-To: sleat@ez.ardent.com (Michael Sleator) Organization: Ardent Computer Corp., Sunnyvale, CA Lines: 55 In article <1580002@hp-ptp.HP.COM> garye@hp-ptp.HP.COM (Gary_Ericson) writes: >What I mean is this. Suppose I want to draw a straight line. When I move the >digitizing pen (or mouse), I will undoubtedly not keep my hand steady and the >line will be crooked. If the computer follows faithfully, I will end up with a >multi-segmented or curved line. But what if the system decided that because >all the points I've digitized lie within a certain tolerance of a straight line >that I really wanted a straight line and it draws one for me. I'm thinking of >maybe giving the pen a certain "thickness" (tolerance) and any points that lie >within that thickness of a straight line really represent a straight line. >Kind of like drawing with a fat felt-tip pen versus a fine pencil point. >It's a little harder for curves or splines, but I wonder if the same idea would >hold: if all the points, within the tolerance, lie along an arc or elipse or >spline of some kind, then the computer translates my sketch into that figure. I think that the threshold approach might be a little awkward. For example, if you do happen to stray out of the fit zone, then you get an abrupt deviation in your curve which you have to go back and correct somehow. It's also not clear to me how you decide what curve to use as a reference. Offhand, it seems that you might run into serious dynamic instabilities in trying to adaptively fit a curve while simultaneously performing this threshold function against it. On the other hand, I don't see how you could choose the curve a priori. Of course, you could specify the curve in some way, such as using spline control points, but that's not freehand drawing. Perhaps you are trying to solve the problem in the wrong domain. It seems to me that what you really want is a low pass filter on the curvature. In general, the "jigglies" (to coin a term) will be significantly higher frequency curvature components than the intended curves. This suggests that there is ample room for choosing a filter cutoff frequency that will kill the jigglies and still allow the desired curves to be drawn. It does imply that if you actually want to create an inflection point, you probably need to do it with two different strokes, but that seems intuitively sensible. I haven't thought very hard about it, but it seems that an algorithm for doing this could be quite simple. As you get each point from the input device, you recompute the local curvature at the growing end of the curve. You then bias the placement of the point according to the filter function. I wonder what it would be like to draw with a high pass curvature filter rather than a low pass. One could also experiment with bandpass and notch filters. A broad notch filter might work to eliminate the jigglies when drawing lines or large-radius curve, yet still allow inflections. Enough speculation. I'd like to hear about it if you try (or anyone else tries or has already tried) this. Michael Sleator Ardent Computer 880 W. Maude Sunnyvale, CA 94086 408-732-0400 ...!{decwrl | hplabs | ubvax | uunet}!ardent!sleat