Ramshandilya / Bezier

Algorithm to draw smooth bezier curves through a set of points
MIT License
234 stars 35 forks source link

It plain and simple just doesn't work #7

Open mdb983 opened 4 years ago

mdb983 commented 4 years ago

Try the following:

Modify your constraints for a width of 3000 and a height of 500. then replace your dataPoints with this: private func createCGPointArray() ->[CGPoint] { var pointArray: [CGPoint?] = [] pointArray.append(CGPoint(x:0, y:0)) pointArray.append(CGPoint(x:54.0, y:0)) pointArray.append(CGPoint(x:108.0, y:0)) pointArray.append(CGPoint(x:162.0, y:0)) pointArray.append(CGPoint(x:217.0, y:0)) pointArray.append(CGPoint(x:271.0, y:0)) pointArray.append(CGPoint(x:325.0, y:0)) pointArray.append(CGPoint(x:379.0, y:0)) pointArray.append(CGPoint(x:434.0, y:0)) pointArray.append(CGPoint(x:488.0, y:0)) pointArray.append(CGPoint(x:542.0, y:0)) pointArray.append(CGPoint(x:597.0, y:0)) pointArray.append(CGPoint(x:651.0, y:0)) pointArray.append(CGPoint(x:705.0, y:0)) pointArray.append(CGPoint(x:759.0, y:0)) pointArray.append(CGPoint(x:814.0, y:0)) pointArray.append(CGPoint(x:868.5, y:0)) pointArray.append(CGPoint(x:922.0, y:0)) pointArray.append(CGPoint(x:977.0, y:0)) pointArray.append(CGPoint(x:1031.0, y:0)) pointArray.append(CGPoint(x:1085.0, y:0)) pointArray.append(CGPoint(x:1139.0, y:0)) pointArray.append(CGPoint(x:1194.0, y:0)) pointArray.append(CGPoint(x:1248.0, y:0)) pointArray.append(CGPoint(x:1302.0, y:39.0)) pointArray.append(CGPoint(x:1357.0, y:177.0)) pointArray.append(CGPoint(x:1411.0, y:236.0)) pointArray.append(CGPoint(x:1465.0, y:157.0)) pointArray.append(CGPoint(x:1519.0, y:295.0)) pointArray.append(CGPoint(x:1574.0, y:354.0)) pointArray.append(CGPoint(x:1628.0, y:414.0)) pointArray.append(CGPoint(x:1682.0, y:414.0)) pointArray.append(CGPoint(x:1737.0, y:414.0)) pointArray.append(CGPoint(x:1791.0, y:473.0)) pointArray.append(CGPoint(x:1845.0, y:473.0)) pointArray.append(CGPoint(x:1899.0, y:473.0)) pointArray.append(CGPoint(x:1954.0, y:236.0)) pointArray.append(CGPoint(x:2008.0, y:236.0)) pointArray.append(CGPoint(x:2062.0, y:157.0)) pointArray.append(CGPoint(x:2116.0, y:78.0)) pointArray.append(CGPoint(x:2171.0, y:39.0)) pointArray.append(CGPoint(x:2225.0, y:0)) pointArray.append(CGPoint(x:2279.0, y:0)) pointArray.append(CGPoint(x:2334.0, y:0)) pointArray.append(CGPoint(x:2388.0, y:0)) pointArray.append(CGPoint(x:2442.0, y:0))

    return pointArray as! [CGPoint]
}

I think you can see this should be a flat line at the bottom of the screen with a "hump" towards the end, then back to Zero. What you get when converting these coordinates is mind boggling.