Instance Method

addCurveToPoint:controlPoint1:controlPoint2:

Appends a cubic Bézier curve to the receiver’s path.

Declaration

- (void)addCurveToPoint:(CGPoint)endPoint controlPoint1:(CGPoint)controlPoint1 controlPoint2:(CGPoint)controlPoint2;

Parameters

endPoint

The end point of the curve.

controlPoint1

The first control point to use when computing the curve.

controlPoint2

The second control point to use when computing the curve.

Discussion

This method appends a cubic Bézier curve from the current point to the end point specified by the endPoint parameter. The two control points define the curvature of the segment. Figure 1 shows an approximation of a cubic Bézier curve given a set of initial points. The exact curvature of the segment involves a complex mathematical relationship between all of the points and is well documented online.

Figure 1

A cubic Bézier curve

You must set the path’s current point (using the moveToPoint: method or through the previous creation of a line or curve segment) before you call this method. If the path is empty, this method does nothing. After adding the curve segment, this method updates the current point to the value in point.

See Also

Constructing a Path

moveToPoint:

Moves the receiver’s current point to the specified location.

addLineToPoint:

Appends a straight line to the receiver’s path.

addArcWithCenter:radius:startAngle:endAngle:clockwise:

Appends an arc to the receiver’s path.

addQuadCurveToPoint:controlPoint:

Appends a quadratic Bézier curve to the receiver’s path.

closePath

Closes the most recently added subpath.

removeAllPoints

Removes all points from the receiver, effectively deleting all subpaths.

appendPath:

Appends the contents of the specified path object to the receiver’s path.

CGPath

The Core Graphics representation of the path.

CGPath

The Core Graphics representation of the path.

currentPoint

The current point in the graphics path.