FROM : Graham Cox
DATE : Fri May 09 03:28:38 2008
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/>
>
>
>
>
DATE : Fri May 09 03:28:38 2008
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/>
>
>
>
>
| Related mails | Author | Date |
|---|---|---|
| Nick Zitzmann | May 8, 10:06 | |
| Graham Cox | May 8, 15:33 | |
| Nick Zitzmann | May 8, 18:51 | |
| Kyle Sluder | May 9, 03:26 | |
| Graham Cox | May 9, 03:28 | |
| Graham Cox | May 9, 03:29 | |
| Nick Zitzmann | May 9, 03:47 |






Cocoa mail archive

