Algorithm to draw smooth bezier curves through a set of points - written in Swift.
ramshandilya / bezier Goto Github PK
View Code? Open in Web Editor NEWAlgorithm to draw smooth bezier curves through a set of points
License: MIT License
Algorithm to draw smooth bezier curves through a set of points
License: MIT License
Is there any way to dynamic add graph points?
CubicCurveALgorithm.swift is not compatible with swift 3 syntax
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.