vector quadratic curve

Everything else that doesn't fall into one of the other PB categories.
Rinzwind
Enthusiast
Enthusiast
Posts: 690
Joined: Wed Mar 11, 2009 4:06 pm
Location: NL

vector quadratic curve

Post by Rinzwind »

https://developer.apple.com/documentati ... rvetopoint
- (void)addQuadCurveToPoint:(CGPoint)endPoint
controlPoint:(CGPoint)controlPoint;

https://developer.apple.com/documentati ... rvetopoint
- (void)addCurveToPoint:(CGPoint)endPoint
controlPoint1:(CGPoint)controlPoint1
controlPoint2:(CGPoint)controlPoint2;

Is it me, or is a 'quadratic Bézier curve' missing in the PB vector library?
User avatar
Michael Vogel
Addict
Addict
Posts: 2807
Joined: Thu Feb 09, 2006 11:27 pm
Contact:

Re: vector quadratic curve

Post by Michael Vogel »

Convert it to 'standard' bezier curves which are available in the vector library.
Rinzwind
Enthusiast
Enthusiast
Posts: 690
Joined: Wed Mar 11, 2009 4:06 pm
Location: NL

Re: vector quadratic curve

Post by Rinzwind »

Distilled and converted from your link and for future reference/help:

Code: Select all

Procedure AddPathCurveQuad(cpx.d, cpy.d, x.d, y.d, Flags = #PB_Path_Default)
  Define cx.d, cy.d
  If Flags = #PB_Path_Default
    cx = PathCursorX()
    cy = PathCursorY()
  EndIf
  
  AddPathCurve(cx + (2.0 / 3.0) * (cpx - cx), 
               cy + (2.0 / 3.0) * (cpy - cy),
               x + (2.0 / 3.0) * (cpx - x),
               y + (2.0 / 3.0) * (cpy - y),
               x, y, Flags)
EndProcedure
Seems to do the trick. Still weird it's not there out-of-the-box.

<edit some bad typo's>
Post Reply