@mgx/bicubic-interpolation
TypeScript icon, indicating that this package has built-in type declarations

0.1.3 • Public • Published

@mgx/bicubic

Simple interpolation library that uses WebGL-2 to do bicubic interpolation.

Installation

npm i @mgx/bicubic-interpolation

Example usage:

import { GridPointProps, SplineRenderer } from '@mgx/bicubic-interpolation';
import { FeatureCollection, Point } from 'geojson';


const canvas = document.getElementById('canvas') as HTMLCanvasElement;

const demoData: FeatureCollection<Point, GridPointProps> = {
    "type": "FeatureCollection",
    "features": [
      {
        "type": "Feature",
        "properties": {
          "row": 1,
          "col": 1,
          "value": 12
        },
        "geometry": {
          "type": "Point",
          "coordinates": [
            56.953125,
            65.94647177615738
          ]
        }
      },
      {
        "type": "Feature",
        "properties": {
          "row": 1,
          "col": 2,
          "value": 14
        },
        "geometry": {
          "type": "Point",
          "coordinates": [
            73.47656249999999,
            66.08936427047088
          ]
        }
      },
  ...
      {
        "type": "Feature",
        "properties": {
          "row": 4,
          "col": 5,
          "value": 9
        },
        "geometry": {
          "type": "Point",
          "coordinates": [
            116.71874999999999,
            54.97761367069628
          ]
        }
      }
    ]
};

const sr = new SplineRenderer(canvas.getContext('webgl2'), demoData, [53.4375, 51.944264879028765, 119.53125, 68.13885164925573]);
sr.render();

Readme

Keywords

Package Sidebar

Install

npm i @mgx/bicubic-interpolation

Weekly Downloads

0

Version

0.1.3

License

Apache-2.0

Unpacked Size

542 kB

Total Files

22

Last publish

Collaborators

  • michaellangbein