delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/08/23/18:34:41

From: Shawn Hargreaves <Shawn AT talula DOT demon DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Splines in Allegro v2.2
Date: Sat, 23 Aug 1997 13:33:41 +0100
Organization: None
Distribution: world
Message-ID: <zorPeFAlit$zEwZP@talula.demon.co.uk>
References: <5tl0lp$poh$1 AT news DOT interlog DOT com>
NNTP-Posting-Host: talula.demon.co.uk
MIME-Version: 1.0
Lines: 33
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Gautam N. Lad writes:
>Problem is, the spline only uses 4 control points. How can I have more 
>points? I looked at ex23.c (From Allegro EXAMPLES), and I was stumped.  

The Bezier spline formulation used by the Allegro code is by nature
defined by four control points: two to specify the end points of the
curve, and two to adjust how it behaves in between them. If you need to
construct a longer, more elaborate shape, you can do it by joining
multiple spline segments together. This is not so hard as it sounds:
just have a shared end point (the last control point of segment one
becomes the first control point of segment two, etc), and make sure that
both curves share a tangent at the join. To do that, set  your curve
control points (the second to last point of the first spline segment,
and the second point of the second segment, etc), to face in opposite
directions from the join point, ie. having decided what line should be
the tangent at the join, place the second to last point of the first
spline some way back along that tangent, and the second point of the
second spline some way forward along the same tangent (adjusting how far
along the line you place them controls the sharpness of the curve). To
get a feel for how this works, run the ex23 from Allegro and press 't'
to display the tangent vectors. Then press 'c' to display the control
points, and watch how they move in and out along the tangents as you
adjust the spline 'curviness'...

Incidentally, I don't think that comp.os.msdos.djgpp isn't the best
forum for questions of this kind: comp.graphics.algorithms would be more
appropriate...



--
Shawn Hargreaves - shawn AT talula DOT demon DOT co DOT uk - http://www.talula.demon.co.uk/
Beauty is a French phonetic corruption of a short cloth neck ornament.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019