# CS 230 Assignment 1

### Fitting data with curves

Description

In this assignment you will write a program to draw curves based on the ones discussed in class. These curves will be constructed by the program to fit a given data set of motion. The data will actually come from the elbow angle of a character animation and your job will be to find a small number of curves that closely match the data. Your program should draw both the data and the curves on the screen as well as compute the distance between the curves and the data (a simple Euclidean distance explained below.) The data can be thought of as the (motion capture) angle over time, recorded for the length of the animation trajectory.

Three test data sets are provided for you to test. But your program should read any such file, in an ascii text file (.txt) that will simply be a string of numbers like: Sample File (txt)
Right-click-save these (larger) files:
New Sample File 1 (txt)
New Sample File 2 (txt)
New Sample File 3 (txt)

Your program will be tested on another data set which has a similar quality but will not be the same data.

You may choose to use either Hermite, Bezier or B-Spline curves. Their degree must be less than five and you may use at most ten curves to match a given data set. Also, if you use B-Splines, at most 50 control points in total may be used. (5 each for 10 curves...)

Your program should draw both the data input (connected with lines) as well as the curves that fit that data. You can write a drawing algorithm that approximates the curves using line segments or try using subdivision to draw the curves.

All the programs must compute the distance the same way and so it will be defined exactly. The distance is the absolute value of the difference between each data value (from the input file) and the exact value of the curve at that same time (i.e. time is the x value) and summed over the set of input points.

NOTES:

When you fit the curves to this data, the sky is the limit in terms of your creativity... for example, you may decide to perform a search for the best way to slice up the data into segments. There are many options when it comes to this. But when you are done, you must draw the curves and score your fit based on the measure above.

I want a short write up (2-pg report) on the approach you took to compute the curve-fit and its benefits. Include in your report images (screen-captures) of the three data files above, I will use these in class to discuss the group's results. The report should be in pdf format.

You will turn in your code and your report with the image files in a single archive file under the corresponding turn-in.