Re: Bezier drawing tool suggestions?
Re: Bezier drawing tool suggestions?
- Subject: Re: Bezier drawing tool suggestions?
- From: Scott Thompson <email@hidden>
- Date: Sat, 4 Mar 2006 23:45:14 -0600
On Mar 4, 2006, at 11:19 PM, John C. Randolph wrote:
On Mar 4, 2006, at 8:04 PM, Scott Thompson wrote:
1) Create a class to represent a bezier curve. The class
represents the curve as point triples. Each triple represents a
"left-side" control point, an on-curve point, and a right-side
control point. The class also has to deal with things like
"isClosed" (though if your shapes are always closed... that could
simplify things a bit.
You need four points to define a Bezier cubic spline. What kind
of curve are you describing?
I'm describing a cubic bezier spline (Or to put it another way a 2D,
cubic, uniform, non-rational B-Spline whose basis functions are
derived from the cubic Berenstein polynomials, but that's not
important right now).
Yes, _geometrically_ speaking you need four control points to define
a cubic bezier segment. However, when _editing_ a curve, you have
some freedom in how you store those points. :-) The scheme I'm
describing is a handy way of storing the control points for the curve
for editing purposes, not (necessarily) for drawing.
FreeHand and illustrator allow you to manipulate a control point to
the left of the "leftmost" on-curve point, and to the right of the
"rightmost" on-curve point. (in this case left and right refer to
the 0 and 1 positions of the parametric variable that defines the
curve).
In the scheme I outlined, a single bezier segment would be defined by
two of the "triplets". The actual segment of the curve that gets
drawn is defined by four points:
1 and 2 : the on-curve point and "right side" BCP of the first triplet
3 and 4 : the "left side BCP" and on-curve point of the second triplet.
The remaining two points of the triplets (the left-side BCP of the
first triplet and right-side BCP of the second triplet) are
"extraneous" points geometrically speaking, but they play a role in
editing the curve as they help establish the direction that the curve
will take if a segment is added at either end. (FreeHand and
illustrator use these "extraneous" points to help you create smooth
joins, or corners between the bezier segments of a longer contour)
If I were better at ASCII art, I would draw what I'm talking about.
Maybe this will help?
triplet 1 : <left-BCP-unused, first-on-curve-point, bcp1-of-first-
drawn-segment>
triplet 2 : <bcp2-of-firstSegment, ending on-curve point, first-bcp-
of-next-segment-to-be-added>
If you have access to FreeHand or Illustrator, start one up and play
with the pen tool. I think you'll see what I'm talking about. The
on-curve points are placed where you mouse the pen tool down. As you
drag the pen tool, you pull out the BCPs in the same triplet on
either side.
Scott
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden