[geeks] Re: Ham license question...

geeks at sunhelp.org geeks at sunhelp.org
Thu Jun 7 21:01:09 CDT 2001


jdboyd at cs.millersville.edu writes:

>On Thu, 7 Jun 2001 dave at cca.org wrote:

>> I wrote a postscript program once that draws successive approximations
>> of a bezier curve, so you can see how the geometric approach works.
>> Kinda neat.

>Still have the code on disk anywhere?

Here is.

The place to set the bezier curve control points is right near the end.


%!PS-Adobe-1.0

/average {
	add 0.5 mul
} def

/bez-lines {
	8 copy
	moveto
	3 {lineto} repeat
	stroke

	/y4 exch def /x4 exch def
	/y3 exch def /x3 exch def
	/y2 exch def /x2 exch def
	/y1 exch def /x1 exch def

	1 sub /depth exch def

	depth 0 gt {

		depth
		x1 y1

		x1 x2 average
		y1 y2 average

		x1 x2 average
		x2 x3 average
			average
		y1 y2 average
		y2 y3 average
			average
		

		x1 x2 average
		x2 x3 average
			average
		x2 x3 average
		x3 x4 average
			average
			average
		y1 y2 average
		y2 y3 average
			average
		y2 y3 average
		y3 y4 average
			average
			average
		
		depth
		3 copy pop

		x2 x3 average
		x3 x4 average
			average
		y2 y3 average
		y3 y4 average
			average

		x3 x4 average
		y3 y4 average
		
		x4 y4

		bez-lines
		bez-lines
	} if
} def

72.0 dup scale  % work in inches
0.5 72.0 div setlinewidth

% depth x1,y1 x2,y2 x3,y3 x4,y4

	8
	1 2
	8 0.5
	6 10
	1 7 

bez-lines

showpage


-- david fischer -- dave at cca.org -- www.cca.org -- Cthulhu told me to. --



More information about the geeks mailing list