npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

akima-interpolator

v1.0.0

Published

Akima spline interpolator

Downloads

364

Readme

This is a javascript library for Akima spline interpolation.

Given a set of points in 2D space this library will interpolate a spline (curved line) which often seems more natural than the result from the more common natural cubic spline interpolation.

This is a port of Java code from the Apache Commons Math library, with a bit of code borrowed from the commons-math-interpolation TypeScript port.

Usage

  import Akima from 'akima-interpolator';
  var akima = new Akima();

  var xvals = [
    10,
    20,
    30,
    40,
    50,
    60,
    70,
    80
  ];

  var yvals = [
    40,
    10,
    17,
    39,
    99,
    120,
    30,
    10    
  ];
  
  var f = akima.createInterpolator(xvals, yvals);

  for(var i=xvals[0]; i < xvals[xvals.length-1]; i++) {
    console.log('x:', i, 'y:', f(i));
  }  

Visual example

Christian d'Heureuse has a nice visual demo of his TypeScript port comparing different interpolations here.

Try to put two points very close to each-other on the x-axis but with differing y-axis values, then put a third point far away on the x-axis but close to the second point on the y-axis. Switch between Natural and Akima to see the difference.

License and copyright

This project is licensed under the AGPLv3 license. A copy of the AGPLv3 license is included in the file LICENSE.txt.

This product includes software developed at The Apache Software Foundation (www.apache.org) which is licensed under the Apache 2 License. A copye of the Apache 2 License is included in the file LICENSE_APACHE.txt.

This project includes code ported from the MIT-licensed commons-math-interpolation library. A copy of the MIT License is included in the file LICENSE_MIT.md.