5.0

5.0 | 1 rating Rate this file 54 downloads (last 30 days) File Size: 19.83 KB File ID: #27374

B-splines

by Levente Hunyadi

 

26 Apr 2010 (Updated 10 May 2010)

Code covered by the BSD License  

Draw, manipulate and reconstruct B-splines.

Download Now | Watch this File

File Information
Description

The package comprises of a graphical utility to place uniform B-spline control points and see how the B-spline is redrawn as control points or control point weights are adjusted, and functions to estimate B-splines with known knot vector, given a set of noisy data points either with known or unknown associated parameter values.

As regards the interactive interface, the user is shown a figure window with axes in which to choose control points of a uniform B-spline. As points are placed in the axes, the B-spline of specified order is drawn progressively. The user may terminate adding control points by pressing ENTER or ESC, or may place the last control point with a right mouse button click.

Once done, control points may be adjusted with drag-and-drop. Hold down the left mouse button over any control point and drag it to another location. Control point adjustment works in 3D; use the rotation tool to set a different camera position. It is also possible to explicitly set the x, y and z coordinates as well as the weight of a control point: click on the point, enter new values and hit ENTER.

As regards the non-interactive interface, functions include calculating and drawing basis functions, computing points of a (weighted or unweighted) B-spline curve with de Boor's algorithm, and estimating B-spline control points given noisy data, either with or without parameter values associated with the observed data points.

From a programmers' perspective, this example illustrates how to use nested functions to extend variable scope, implement drag-and-drop operations, combine normalized and pixel units for control docking and register multiple callbacks for a single event in an interactive user interface.

USAGE

The simplest way to get started is to run "bspline_gui", which activates the figure window to place B-spline control points interactively. Examples are bundled to illustrate various B-spline curve computation and approximation methods.

MATLAB release MATLAB 7.6 (R2008a)
Zip File Content  
Other Files
bspline_approx.m,
bspline_basis.m,
bspline_basismatrix.m,
bspline_deboor.m,
bspline_estimate.m,
bspline_footpoint.m,
bspline_gui.m,
bspline_wapprox.m,
bspline_wdeboor.m,
Contents.m,
example_bindevent.m,
example_bsplineapprox.m,
example_bsplinebasis.m,
example_bsplinedeboor.m,
example_bsplineestim.m,
example_bsplinefoot.m,
funminbnd.m,
gui_bind_event.m,
gui_dock_vertical.m,
guipoints.m,
license.txt,
README,
uispanedit.m
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (2)
24 Jun 2010 Evgeny Pr  
27 Jun 2010 Evgeny Pr

Hello!
Thank you for good job!

I found one error in the function "bspline_wdeboor". The problem in if statement (if nargin > 5).
Must be:
if (nargin < 5)
    [Y,u] = bspline_deboor(n,t,P);
else
    [Y,u] = bspline_deboor(n,t,P,u);
end

The same approximation is unstable. Strongly depends on the knots vector.

Please login to add a comment or rating.
Updates
02 May 2010

Added control point weights and control point approximation from data.

10 May 2010

Added estimation without known B-spline curve parameter values.

Tag Activity for this File
Tag Applied By Date/Time
bspline Levente Hunyadi 27 Apr 2010 10:32:14
drag and drop Levente Hunyadi 27 Apr 2010 10:32:14
ginput Levente Hunyadi 27 Apr 2010 10:32:14
spline Levente Hunyadi 27 Apr 2010 10:32:14
nurbs Levente Hunyadi 27 Apr 2010 10:32:14
gui Levente Hunyadi 27 Apr 2010 10:32:14
bspline Peter Simon 26 May 2010 00:36:52

Contact us at files@mathworks.com