[comp.graphics] Curve through 3 points

cleron@Sunburn.Stanford.EDU (Michael A. Cleron) (08/14/90)

I'm writing a program for a Mac that involves drawing a network.  I
need an algorithm for drawing the connecting arcs.  The idea is that
the start and end points will be fixed, and there will be a movable
midpoint.  The algorithm should produce a pleasing line from the start
point to the end point that passes through the midpoint.  Preferred
language is C, but I'll take whatever I can get.

Please reply via e-mail since I do not read this group.  Thanks,

Mike
cleron@sunburn.stanford.edu

mcooper@sunb5.cs.uiuc.edu (08/14/90)

look under "Bezier Curves" in any graphics textbook 
(Foley &VanDam come to mind)

montnaro@spyder.crd.ge.com (Skip Montanaro) (08/15/90)

In article <23900010@sunb5> mcooper@sunb5.cs.uiuc.edu writes:

   look under "Bezier Curves" in any graphics textbook 
   (Foley &VanDam come to mind)

Bezier curves have several nice properties, including local spline control,
the control points form a convex hull for the spline, and the ability to
easily make successive chunks piecewise continuous, but they don't
interpolate their control points. That make them more difficult to use
interactively, since the curve generated is not immediately obvious from the
control points.

A simple place to see an easily implementable definition is in the
PostScript Red Book, under the section on the curveto operator. The
PostScript generated by the idraw graphics editor generates multi-segment
bezier curves that are piecewise continuous.




--
Skip (montanaro@crdgw1.ge.com)

bdd@calmasd.Prime.COM (Brian Donahue) (08/16/90)

>In article <23900010@sunb5> mcooper@sunb5.cs.uiuc.edu writes:
>
>   look under "Bezier Curves" in any graphics textbook 
>   (Foley &VanDam come to mind)
>
>Bezier curves have several nice properties, including local spline control,
>the control points form a convex hull for the spline, and the ability to
>easily make successive chunks piecewise continuous, but they don't
>interpolate their control points. That make them more difficult to use
>interactively, since the curve generated is not immediately obvious from the
>control points.
>
By now, I've forgotten what the original poster wanted, but s/he might
try parabolas in the Bezier format.  For a crv through the 3 points
(P0, P1, and P2), the bezier quadratic that 'fits' that data 
looks something like:

		C1
		*

		*
		P1

	*	*	*
	P0	m	P2
	C0		C2

where C0,C1, and C2 are control points (C0=P0, C2=P2, and P1 = (m+C1)/2
where m = (P0+P2)/2..)  Look at "The twisted cubic curve: a CAGD approach"
A.R. Forrest, CAD vol. 12, #4, july 80 for more on bezier/conics.

'course, if you wanted arcs, or wanted to string continuous curves thru
more than 3 points, you've got more work to do...:-)

good luck,
bd
\/