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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to