[comp.sys.mac.programmer] Bezier curves in QuickDraw

tim@maths.tcd.ie (Timothy Murphy) (11/30/90)

Is there a routine anywhere in QuickDraw,
or elsewhere in the Toolbox,
for drawing Bezier curves?

If not, does anyone have a routine for doing this?
Is it best to approximate the curve by a polygon,
or to determine the actual pixels?

Any suggestions gratefully received.

-- 

Timothy Murphy  

e-mail: tim@maths.tcd.ie

niko@iastate.edu (Schuessler Nikolaus E) (12/01/90)

In article <1990Nov29.181603.18132@maths.tcd.ie> tim@maths.tcd.ie (Timothy Murphy) writes:
>Is there a routine anywhere in QuickDraw,
>or elsewhere in the Toolbox,
>for drawing Bezier curves?
>
 I don't think so.

>If not, does anyone have a routine for doing this?
 There is a demo program that does it... who ever wrote it might be willing
 to give out the source.

 I have a project due soon that is supposed to do exactly that.  If you
 can grab a copy of the book "Computer Graphics: A programming approach"
 by Steven Harrington (ISBN 0-07-026751-0) it gives you pseudo code that
 can be directly converted to pascal code (and adjusted slightly for C).

>Is it best to approximate the curve by a polygon,
>or to determine the actual pixels?

 If you make the polygon's sides smaller and smaller until they're the size of
 a pixel you won't be able to tell that it's a polygon.

>
>Any suggestions gratefully received.
>

You're welcome.




--
------------------------------------------------------------------------------
Niko Schuessler               "On a two semester mission to engineer where
niko@iastate.edu               no-one has engineered before.... :-) "
------------------------------------------------------------------------------

minow@mountn.dec.com (Martin Minow) (12/03/90)

In article <1990Nov29.181603.18132@maths.tcd.ie> tim@maths.tcd.ie
(Timothy Murphy) writes:

>Is there a routine anywhere in QuickDraw, or elsewhere in the Toolbox,
>for drawing Bezier curves?

No.

>If not, does anyone have a routine for doing this?

There was an article in MacTutor last (or last++) year.  Can you get
it in Ireland (we can get Guiness in Boston)?  MacTutor publishes a
yearly collection that is probably worth reading.

Another source might be the recently published book Graphics Gems.

>Is it best to approximate the curve by a polygon,
>or to determine the actual pixels?

I believe that if you export a Bezier curve from a drawing program to
a PICT resource/file, it is written as a polygon with short steps.  That way
the PICT can be scaled without losing too much detail.

Martin Minow
ps: (full disclosure) I've written a few articles for MacTutor, and
Mike Morton, who contributes to comp.sys.mac.programmer has a "gem"
in Graphics Gems.