I have UIBezierPath in the application. When the finger touch on the path is recognized i want to subdivide that curve and store that two curves into two different objects. So touch co-ordinates will work as end-point for one curve and start-point for second curve.
Again if i touch on any of this curve, that curve will subdivide into two other curves and so on.
I searched for this a lot. But could not find any good solution.
Also I do not have idea if there is any other way to do this. Any help would be greatly appreciated. Thanks
A UIBezierPath object combines the geometry of a path with attributes that describe the path during rendering. You set the geometry and attributes separately and can change them independent of one another. After you have the object configured the way you want it, you can tell it to draw itself in the current context.
Because the creation, configuration, and rendering process are all distinct steps, Bézier path objects can be reused easily in your code. You can even use the same object to render the same shape multiple times, perhaps changing the rendering options between successive drawing calls.
Subdividing splits selected edges and faces by cutting them in half or more, adding new vertices, and subdividing accordingly the faces involved. It adds resolution to the mesh by divide faces or edges into smaller units. This process follows a few rules, depending on the settings:
A single Bézier path object can contain any number of open or closed subpaths, where each subpath represents a connected series of path segments. Calling the close () method closes a subpath by adding a straight line segment from the current point to the first point in the subpath.
You can do this with the de Casteljau algorithm. If you're really into the maths of it check out the Wikipedia page here, but if you're not that into the maths it will probably confuse you more than anything when it's actually quite simple...
Now you have two new Bezier curves, the first using control points A1, B1, C1, D1 and the second using A2, B2, C2, D2.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With