Bezier curves control points calculation (not only) in iOS

Published by Petrakeas in Software

Screen-Shot-2012-06-17-at-2

Core Graphics in iOS have many capabilities in creating, manipulating and rendering paths. Many developers want to create a path that passes “smoothly” through some given points using bezier curves. This requires that you calculate the control points of the bezier curve yourself, because  Core graphics doesn’t have a function to do that.

This is why I have created these functions. They can receive a CGPath (consisting only of straight lines) and produce a smoothed version that consists of bezier curves. The computation of the control points is done automatically and depends on the given “tension” variable.  I’d like to mention that these functions can be used in other APIs besides CoreGraphics.

I have added these functions in my “outline calculation” functions. I have updated the demo to make use of both of them separately and in chain (calculate a smoothed version of the outline of a path). Take a look of the demo below!

If you want to use these functions, take a look at my repo at github where the demo and the functions with their documentation reside.

PS. If you want to see these functions in action in a full fledged app, download Soundbeam app

Comments (3)

iOS function to create a path’s outline at Wiggler

[...] UPDATE: I have added some more functions that help in the creation of bezier curves and updated the demo accordingly. Read the post here. [...]

June 18th, 2012 at 10:52 pm

Fastest way to draw shadows and blend layers in iOS at Wiggler

[...] I added some functions to create bezier curves easily. Read the post here. Related postsBezier curves control points calculation (not only) in [...]

June 18th, 2012 at 10:55 pm

Clint

Reports conducted with both equally small children and adults have indicated that propolis therapy can assist elimimate parasites thgat complicate
uulcerative colitis. Tender throat lozenges, specially inside of the natural and organic selection, condist of — you
have obtained execuhting so – propolis. The bioflavenoids present
in propolis bolster the body’s immune program, enhancing our resistance to disorder propolis dietary supplements the
efficiency of vitamin C and stimulates enzymne development.

August 30th, 2014 at 10:13 pm

Leave a reply