View Full Version : turning mouse input into splines

virgil

10-28-2004, 03:32 PM

My input is a sequence of mouse points, typically of adjacent pixel coordinates. I'd like to approximate this input with some form of bezier curve or spline. Ultimatly I'll want to use a NURBS representation so I can "wiggle" the input in some intuitively meaningful way.

But how do I choose from this massive data set the points that will best serve as control points?

I've spent the day googling for ways to do this and either the right pages did not turn up or I didn't know enough to notice them when they did.

Can anyone advise where I should look for an answer to this problem which must be common to most direct input graphics applications.

The books I'm currently using are Watt: 3d Computer Graphics; Hearn & Baker: Computer Graphics C version; and I've just ordered Angel: Interactive Computer Graphics: A Top-Down Approach with OpenGL (International Edition)

mikael_aronsson

10-28-2004, 11:57 PM

Hi !

What you need is something called splinr interpolation, you feed it with a number of sample points from a curve and in return you get a spline curve with a curve as close as possible to your points.

OpenGL itself does not have any support for interpolation so you will have to implement it yourself or get a library that supports it like IRIT for example, I do think there is a nurb library on sourceforge that supports interpolation also.

Mikael

virgil

10-29-2004, 03:52 AM

Mikael hi

thanks for the tips.

Googled and googled again. Went into IRIT and sourceforge.

Sourceforge found nothing that looked like what i'm searching for,

IRIT has loads of stuff but you need to know more or less precisely what you're looking for, how to use it etc.

NAG library also full of useful stuff but again you need to know what you need.

As example, I have lots of mouse points, what should be my basis for selecting the ones to feed into the curve fitter? There have to be answers to this because for instance photoshop does spline curves with its pen tool. I suspect that solutions to the problem of point selection are a bit ad hoc, i.e. horses for courses, which is why there is so little (no?) academic treatment of it. But a few examples of the kinds of horses used on given courses would give me an idea of how to approach the problem.

I have considered starting with four control points for whole curve then doing an error minimisation process with successive subdivision of the line by adding control points in sections where the error exceeds given threshold.

But it seems strange that there is so little discussion of this. Perhaps people don't do much freehand input to graphics aps?

Anyway, thanks for your advice.

Will keep slogging.

virgil

10-29-2004, 07:24 AM

I found some sites of interest which might also interest others.

This

http://www.cs.kuleuven.ac.be/~nalag/research/topics/csf.shtml

pointed to the FITBACK library of subroutines for calculating smoothing splines for various kinds of data and geometries, with automatic knot selection

http://www.netlib.org/dierckx/

NAG library

http://www.ualberta.ca/CNS/RESEARCH/NAG/FL90r4/html/c08_fn04.html

with discussion (pdf file)

http://www.ualberta.ca/CNS/RESEARCH/NAG/FL77/f77/Manual/E02/e02_intro_fl19.pdf

There seem also to exist work on evolutionary algorithms for knot identification but I have not gone down that path.

Powered by vBulletin® Version 4.2.3 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.