{"id":15653758,"url":"https://github.com/spite/three.constantspline","last_synced_at":"2025-04-23T16:25:21.690Z","repository":{"id":18553488,"uuid":"21755076","full_name":"spite/THREE.ConstantSpline","owner":"spite","description":"Constant-time B-Spline","archived":false,"fork":false,"pushed_at":"2016-03-18T20:03:52.000Z","size":300,"stargazers_count":28,"open_issues_count":0,"forks_count":8,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-30T01:30:17.134Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/spite.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-07-11T23:29:48.000Z","updated_at":"2024-03-13T21:10:04.000Z","dependencies_parsed_at":"2022-09-02T04:02:53.473Z","dependency_job_id":null,"html_url":"https://github.com/spite/THREE.ConstantSpline","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spite%2FTHREE.ConstantSpline","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spite%2FTHREE.ConstantSpline/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spite%2FTHREE.ConstantSpline/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spite%2FTHREE.ConstantSpline/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spite","download_url":"https://codeload.github.com/spite/THREE.ConstantSpline/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250469006,"owners_count":21435576,"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","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":[],"created_at":"2024-10-03T12:46:57.557Z","updated_at":"2025-04-23T16:25:21.667Z","avatar_url":"https://github.com/spite.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"THREE.ConstantSpline.js\n=========================\n\nThis object creates a B-Spline using 4 points, and a number steps or a fixed step distance can be specified to create a set of points that cover the curve at constant rate.\n\n![Image](https://raw.githubusercontent.com/spite/THREE.ConstantSpline/master/snapshot.png)\n\nDemos are here: \n* [Lines](http://www.clicktorelease.com/tmp/threejs/constant-spline/lines.html)\n* [Surfaces](http://www.clicktorelease.com/tmp/threejs/constant-spline/surface.html)\n\n\nHow to use\n----------\n\nInclude the library:\n\u003cpre\u003e\u003ccode\u003e\u0026lt;script src=\"THREE.ConstantSpline.js\" \u0026gt;\u0026lt;/script\u0026gt;\u003c/code\u003e\u003c/pre\u003e\n\nInstantiate a THREE.ConstantSpline object:\n\u003cpre\u003e\u003ccode\u003evar s = new THREE.ConstantSpline();\u003c/code\u003e\u003c/pre\u003e\n\nassign the 4 control points:\n\n\u003cpre\u003e\u003ccode\u003es.p0 = new THREE.Vector3( .5 - Math.random(), .5 - Math.random(), .5 - Math.random() );\ns.p1 = new THREE.Vector3( .5 - Math.random(), .5 - Math.random(), .5 - Math.random() );\ns.p2 = new THREE.Vector3( .5 - Math.random(), .5 - Math.random(), .5 - Math.random() );\ns.p3 = new THREE.Vector3( .5 - Math.random(), .5 - Math.random(), .5 - Math.random() );\u003c/pre\u003e\u003c/code\u003e\n\nmake the calculations of the standard b-spline:\n\n\u003cpre\u003e\u003ccode\u003es.calculate();\u003c/pre\u003e\u003c/code\u003e\n\nspecify if you need a constant number of steps or a constant step size:\n\n\u003cpre\u003e\u003ccode\u003es.calculateDistances();\ns.reticulate( { distancePerStep: .1 });\u003c/pre\u003e\u003c/code\u003e\n\n\u003cpre\u003e\u003ccode\u003es.calculateDistances();\ns.reticulate( { steps: 500 } );\u003c/pre\u003e\u003c/code\u003e\n\n\u003ccode\u003es.lPoints\u003c/code\u003e contains the evenly separated points. Use them to create a line, a mesh or a camera path:\n\n\u003cpre\u003e\u003ccode\u003evar geometry = new THREE.Geometry();\n   \nfor( var j = 0; j \u0026lt; s.lPoints.length - 1; j++ ) {\n\n\tvar from = s.lPoints[ j ],\n\t\tto = s.lPoints[ j + 1 ];\n\tgeometry.vertices.push( from.clone() );\n    geometry.vertices.push( to.clone() );\n\n}\n\nmaterial = new THREE.LineBasicMaterial( { \n\tcolor: 0x404040 + Math.random() * 0xbfbfbf, \n\tlinewidth: 4\n} );\n\nvar line = new THREE.Line( geometry, material );\nscene.add( line );\u003c/code\u003e\u003c/pre\u003e\n    \nLicense\n-------\n\nMIT licensed\n\nCopyright (C) 2014 Jaume Sanchez Elias http://twitter.com/thespite\n\nhttp://www.clicktorelease.com","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspite%2Fthree.constantspline","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspite%2Fthree.constantspline","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspite%2Fthree.constantspline/lists"}