{"id":20750537,"url":"https://github.com/micycle1/spliner","last_synced_at":"2026-04-18T23:31:22.019Z","repository":{"id":133574959,"uuid":"334702398","full_name":"micycle1/Spliner","owner":"micycle1","description":"Piecewise curve approximation for Processing","archived":false,"fork":false,"pushed_at":"2023-07-02T00:41:43.000Z","size":367,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-11T14:22:19.501Z","etag":null,"topics":["algorithms","bezier-curves","curve-fitting","piecewise-approximation","processing","processing4","shape-fitting"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/micycle1.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-01-31T16:32:47.000Z","updated_at":"2024-06-23T04:58:57.000Z","dependencies_parsed_at":null,"dependency_job_id":"e429bbb6-6c4a-463d-8e1e-5a5035cf2377","html_url":"https://github.com/micycle1/Spliner","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/micycle1/Spliner","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micycle1%2FSpliner","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micycle1%2FSpliner/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micycle1%2FSpliner/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micycle1%2FSpliner/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/micycle1","download_url":"https://codeload.github.com/micycle1/Spliner/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micycle1%2FSpliner/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28012085,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-12-24T02:00:07.193Z","response_time":83,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["algorithms","bezier-curves","curve-fitting","piecewise-approximation","processing","processing4","shape-fitting"],"created_at":"2024-11-17T08:27:48.198Z","updated_at":"2025-12-24T23:05:23.120Z","avatar_url":"https://github.com/micycle1.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![](https://jitpack.io/v/micycle1/Spliner.svg)](https://jitpack.io/#micycle1/Spliner)\n\n# Spliner\nPiecewise curve approximation for Processing 4+.\n\n*Spliner* constructs piecewise curves that have the best fit to a list of points. Four algorithms are implemented:\n\n- Quad + Bezier curve fitting\n- Smooth Fitting\n- Least-square fitting\n- Polygon fitting\n\nAlgorithms by [Andrés Solís Montero](https://github.com/asolis/curveFitting).\n\n\u003cp float=\"middle\"\u003e\n  \u003cimg src=\"resources/spliner.gif\" width=500px/\u003e\n\u003c/p\u003e\n\n## Usage\n```\nList\u003cPVector\u003e points;\nFitting fitting = new BezierFitting(); // or new LeastSquareFitting(), etc.\nList\u003cShape\u003e beziers = fitting.fitCurve(points);\n\nfor (var curve : curves) {\n    if (curve instanceof CubicCurve) {\n        var c = (CubicCurve) curve;\n        bezier(c.getX1(), c.getY1(), c.getCtrlX1(), c.getCtrlY1(), c.getCtrlX2(), c.getCtrlY2(), c.getX2(), c.getY2());\n    } else { // straight-line segments\n        var l = (Segment) curve;\n        line(l.getX1(), l.getY1(), l.getX2(), l.getY2());\n    }\n}\n```\n\n## Example\n\u003cdetails\u003e\u003csummary\u003eProcessing Code...\u003c/summary\u003e\n\n```\nimport processing.javafx.*;\nimport micycle.spliner.fitting.*;\nimport micycle.spliner.geom.*;\nimport java.util.ArrayList;\nimport java.util.List;\n\nList\u003cPVector\u003e points;\nList\u003cLine\u003e curves;\nint fittingType = 0;\n\nvoid setup() {\n  size(800, 800, FX2D);\n  colorMode(HSB, 1, 1, 1);\n\n  populatePoints();\n  fit();\n}\n\nvoid draw() {\n  background(0, 0, 1);\n\n  int i = 0;\n  for (var curve : curves) {\n    stroke(color(i * (1f / curves.size()), 1, 1));\n    strokeWeight(10);\n    if (curve instanceof CubicCurve) {\n      var c = (CubicCurve) curve;\n      bezier(c.getX1(), c.getY1(), c.getCtrlX1(), c.getCtrlY1(), c.getCtrlX2(), c.getCtrlY2(), c.getX2(), c.getY2());\n      stroke(color(0.4, 1, 0.8));\n      strokeWeight(2);\n      line(c.getX1(), c.getY1(), c.getCtrlX1(), c.getCtrlY1()); // cp line\n      line(c.getX2(), c.getY2(), c.getCtrlX2(), c.getCtrlY2()); // cp line\n    } else { // straight-line segments\n      var l = (Segment) curve;\n      line(l.getX1(), l.getY1(), l.getX2(), l.getY2());\n    }\n    i++;\n  }\n}\n\nvoid fit() {\n  Fitting f = null;\n  switch (fittingType % 4) {\n  case 1 :\n    f = new BezierFitting();\n    break;\n  case 0 :\n    f = new LeastSquareFitting();\n    break;\n  case 2 :\n    f = new PolygonFitting();\n    break;\n  case 3 :\n    f = new SmoothFitting();\n    break;\n  }\n  curves = f.fitCurve(points);\n}\n\nvoid populatePoints() {\n  points = new ArrayList\u003c\u003e();\n  for (int x = 0; x \u003c width; x+=20) {\n    points.add(new PVector(x, noise(x+frameCount) * height));\n  }\n}\n\nvoid mousePressed() { // click to fit a new point set\n  populatePoints();\n  fit();\n}\n\nvoid keyPressed() { // press to switch fitting algorithm\n  fittingType++;\n  fit();\n}\n\n```\n\u003c/details\u003e","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicycle1%2Fspliner","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmicycle1%2Fspliner","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicycle1%2Fspliner/lists"}