Re: Quadratic curves in NSBezierPath
Re: Quadratic curves in NSBezierPath
- Subject: Re: Quadratic curves in NSBezierPath
- From: Graham Cox <email@hidden>
- Date: Fri, 9 May 2008 11:28:38 +1000
If you can use Core Graphics, there is: CGPathAddQuadCurveToPoint
If using NSBezierPath, some simple maths will get you the needed
control points, this googled up from http://fontforge.sourceforge.net/bezier.html
Any quadratic spline can be expressed as a cubic (where the cubic term
is zero). The end points of the cubic will be the same as the
quadratic's.
CP0 = QP0
CP3 = QP2
The two control points for the cubic are:
CP1 = QP0 + 2/3 *(QP1-QP0)
CP2 = CP1 + 1/3 *(QP2-QP0)
where the quadratic curve is QP0-QP1-QP2
and the cubic is CP0-CP1-CP2-CP3
hth,
G.
On 9 May 2008, at 2:51 am, Nick Zitzmann wrote:
On May 8, 2008, at 7:33 AM, Graham Cox wrote:
A cubic bezier with the two control points set to the same value is
equivalent to a quadratic bezier. In other words the cubic is a
superset of the quadratic.
Why do you need quadratics specifically?
I'm reading in a file format that uses only a single control point
for curved edges.
Nick Zitzmann
<http://www.chronosnet.com/>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden