¡@

Home 

2014/10/15 ¤U¤È 10:15:07

iphone Programming Glossary: ttt

Drawing Smooth Curves - Methods Needed

http://stackoverflow.com/questions/8702696/drawing-smooth-curves-methods-needed

p2 using Catmull Rom splines for int i 1 i granularity i float t float i 1.0f float granularity float tt t t float ttt tt t CGPoint pi intermediate point pi.x 0.5 2 p1.x p2.x p0.x t 2 p0.x 5 p1.x 4 p2.x p3.x tt 3 p1.x p0.x 3 p2.x p3.x ttt.. tt t CGPoint pi intermediate point pi.x 0.5 2 p1.x p2.x p0.x t 2 p0.x 5 p1.x 4 p2.x p3.x tt 3 p1.x p0.x 3 p2.x p3.x ttt pi.y 0.5 2 p1.y p2.y p0.y t 2 p0.y 5 p1.y 4 p2.y p3.y tt 3 p1.y p0.y 3 p2.y p3.y ttt smoothedPath addLineToPoint pi Now.. p3.x tt 3 p1.x p0.x 3 p2.x p3.x ttt pi.y 0.5 2 p1.y p2.y p0.y t 2 p0.y 5 p1.y 4 p2.y p3.y tt 3 p1.y p0.y 3 p2.y p3.y ttt smoothedPath addLineToPoint pi Now add p2 smoothedPath addLineToPoint p2 finish by adding the last point smoothedPath..