Giter VIP home page Giter VIP logo

lerp's Introduction

Lerp

Lerp is a tiny JavaScript library for all of your linear interpolation needs. Lerp is free to use, less than 2 kB, and dependent-free. You can manually enter data as points or as arrays and matrices. Lerp allows you to linearly approximate a data point in the blink of an eye. Get Lerp!

How to Use

Lerp supports both single and bilinear (double) interpolation. If you already know all the data points for interpolation, using Lerp is very simple! Single interpolate between points with one line of code.

lerp.s.pt(a1, a2, b1, b2, givenA);

Double interpolation is just as easy!

lerp.d.pt(a1, a2, b1, b2, c1, c2, c3, c4, givenA, givenB);

If you have data in arrays instead of individual points, Lerp can interpolate that too!

var arrayA = [1, 2, 3];
var arrayB = [1, 4, 5];
var givenA = 2;

lerp.s.arr(arrayA, arrayB, givenA);

Double interpolation can be peformed using with 2 arrays and a matrix of data.

var arrayA = [1, 2, 3];
var arrayB = [1, 4, 5];
var matrixC = [[1, 2, 3], [4, 5, 6], [7, 8, 9]];

var givenA = 2;
var givenB = 3.5;

lerp.d.arr(arrayA, arrayB, matrixC, givenA, givenB);

Contribute

Want to see or build an awesome feature? Fork the project!

© 2018 by Dominic Nguyen.

lerp's People

Contributors

domwon avatar

Stargazers

 avatar  avatar Future Infinity avatar xufanglu avatar Dominic Lan avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.