Skip to content

secondstory/Path.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Path.js

Turn a collection of time stamped 3D coordinates into a continuous path that has infinite resolution as a function of time.

var data = [];
var x, y, z, t;
for (var i = 0; i < 100; i++) {
  x = Math.round( Math.random() * 1000 );
  y = Math.round( Math.random() * 1000 );
  z = Math.round( Math.random() * 1000 );

  // will work with uneven time stamping
  if (i < 50) {
    t = i * 10;
  } else {
    t = i * 20;
  }
  
  console.log("x: ", x, "y: ", y, "z: ", z, "t: ", t);

  data.push( new Point(x, y, z, t) );
}

var path = new Path(data);

console.log("t = 200.1", path.getXYZ(200.1) );
console.log("t = 1013.3", path.getXYZ(1013.3) );

Copyright (c) 2013 - Second Story [http://www.secondstory.com]
This code is licensed under the MIT License.
For more information visit : https://github.com/secondstory/Path.js

About

Create a linear approximation for a set of data

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published