## How to arbitarily break a bezier.

### How to arbitarily break a bezier.

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

49-53 Barry ST                          tele:   +61-3-3471722
Carlton                                 fax:    +61-3-3472175
Vic 3053
AUSTRALIA

### How to arbitarily break a bezier.

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

### How to arbitarily break a bezier.

Quote: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

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

### How to arbitarily break a bezier.

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

I am using PSP7, and I'm currently working with a vector bezier curve (don't
know if that's the proper name, I'm new at this) which consists of only two
nodes: the start and finish.  What I want to do is break the curve into
smaller segments but without altering the shape of the curve at all.  When I
add a new node to the curve, the curve moves slightly.
The reason I need to break up the curve is that I want to add text along
the path of the curve, but some of it will be going one direction and some
will be going another.  I simply want the beautiful curve I made to stay the
way it was when I drew it, but I need to be able to work with it as a series
of segments.
Also, is there a way to "lock" nodes/curves so that they can't be
altered accidentally?  That would actually solve my problem right there I'd
think.

Thanks,
Graham