Connecting points with smooth curves
A typical problem which arises in designing an object is that of
connecting a sequence of points by a smooth curve. For example, in
designing a car body engineers may have determined several points
on the body and the designer must connect them with an esthetically
pleasing curve. Computer graphics and type face design offer similar
challenges. A spline is the mathematical term for a curve which passes
through a sequence of given points
and
which has some prescribed nice property between neighbouring points
and
. One of the simplest such proeprties is that of
being quadratic; so a quadratic spline for a sequence of points
is a function f which has different
definitions on each of the intervals
such that on
each of these intervals the function is quadratic. It is also required
that at each of the points
the transition from one
definition to
the other is smooth -- namely the tangents from both the left and right
have the same slope.
Write a procedure -- TwoPointSpline -- which, when given the
inputs (m, P1, P2), will find a
quadratic function passing through the two points P1 and P2 and
having slope m at the first point P1. Using this procedure find a
quadratic spline through the points (1,1), (2,2), (4, 5/2), (5,0)
and having slope -2 at the point (1,1). Using the knowledge you have
gained in this exercise, write a procedure that will find a quadratic
spline through any given sequence (list) of points with a given slope at the
first point. Test your procedure on the sequence which can be viewed
by clicking
here
and then
downloaded using Netscape's "save" command.
So far, only splines of points forming a function have been discussed,
However, it is also possible to create more general curves with
splines. Consider the quadratic parametric curve
defined
by:
. Given two points, p1
and p2 in the plane as well as two slopes m1 and m2 and an
interval [u.v], define a
general procedure which will define a curve
such that
How can the last two conditions be interpreted geometrically? Give an
example of points p1
and p2 in the plane as well as two slopes m1 and m2 for which it
is not possible to define a quadratic function which passes through
p1 and p2 and has slope m1 at p1 and m2 at p2.
Using ideas similar to those of the first part, create general
procedure which connect points in the plane with quadratic curves with
prescribed slopes at the given points. Use this procedure to create a
quadratic spline which writes your initials. You will have to use the
plot command in the form plot([g1(t),g2(t),t=a..b]) where
g1 and g2 are the coordinates of the parametrized quadratic curve
and [a,b] is its domain.
Instructor
Juris Steprans
email address: steprans@mathstat.yorku.ca
Department of Mathematics and Statistics.
Ross 536 North, ext. 33921
York University
Back to Department's Public Page