[comp.graphics] How to arbitarily break a bezier.

cn@allgfx.agi.oz (Con Neri) (09/13/90)

Does anybody know of an alogorithm for splitting a known bezier curve into two 
curves at an arbitary point? I have a reference to an algorithm but am unable
to get a copy here in OZ. The article is

"Arbitrary Subdivision of Bezier Curves," by B. A Barsky TR UCB/CSD 85/265
Comp Sci Div, University of California, Berkeley, November 1985.

If anyone can help, either by sending me a copy of the article or providing
some theory or pointing me to some easily available reference I would greatly
appreciate it.

Thanks in anticipation

CON NERI

All Graphic R+D				e-mail: cn@allgfx.agi.oz.au
49-53 Barry ST				tele:   +61-3-3471722
Carlton					fax:    +61-3-3472175
Vic 3053			
AUSTRALIA

peter@aragorn.cm.deakin.oz.au (Peter Horan) (09/13/90)

See Foley Van Dam Feiner & Hughes which is open before me at the very topic pp507-514

Given the control points P1, P2, P3, P4, a Bezier curve may be split in half by computing L1 - L4 and R1 - R4
where
	L1 = P1
	L2 = (P1 + P2)/2
	H  = (P2 + P3)/2
	L3 = (L2 + H)/2
	R2 = (H + R3)/2
	L4 = R1 = (L3 + R2)/2
	R3 = (P3 + P4)/2
	R4 = P4

Draw a picture of it all. Its nice and easy.
-- 
Peter Horan
peter@deakin.oz.au

spencer@eecs.umich.edu (Spencer W. Thomas) (09/13/90)

More generally, you can split a Bezier curve at an arbitrary parameter
value t by using the deCasteljau algorithm.  If the curve has control
points P[i] numbered from 0 to n, then let

	P[0,i] = P[i], 				 i = 0 .. n
	P[j,i] = (1-t) P[j-1,i] + t P[j-1,i+1],  j = 1 .. n, i = 0 .. n - j

The control points for the two halves are then
	L[i] = P[i,0]				 i = 0 .. n
	R[i] = P[n-i,i]				 i = 0 .. n

Various space optimizations are possible.

--
=Spencer W. Thomas 		EECS Dept, U of Michigan, Ann Arbor, MI 48109
spencer@eecs.umich.edu		313-936-2616 (8-6 E[SD]T M-F)

robert@texas.asd.sgi.com (Robert Skinner) (09/13/90)

In article <776@sol.deakin.OZ.AU>, peter@aragorn.cm.deakin.oz.au (Peter
Horan) writes:
|> See Foley Van Dam Feiner & Hughes which is open before me at the very
topic pp507-514
|> 
|> Given the control points P1, P2, P3, P4, a Bezier curve may be split
in half by computing L1 - L4 and R1 - R4
|> where
|> 	L1 = P1
|> 	L2 = (P1 + P2)/2
|> 	H  = (P2 + P3)/2
|> 	L3 = (L2 + H)/2
|> 	R2 = (H + R3)/2
|> 	L4 = R1 = (L3 + R2)/2
|> 	R3 = (P3 + P4)/2
|> 	R4 = P4
|> 
|> Draw a picture of it all. Its nice and easy.
|> -- 
|> Peter Horan

Or, if you want to split it into any a:1-a ratio, you can generalize 
the above interpolation equations:

	L2 = a*P1 + (1-a)*P2
	...

etc, etc.

So that splits the Bezier at an arbitrary point in *parameter* space.
Is that really what you wanted?  Or did you want to split it in object
space?

Robert Skinner
robert@sgi.com

	When I woke up this morning, my girlfriend asked if I had slept well.  
	I said, "no, I made a few mistakes."