GithubHelp home page GithubHelp logo

gl-vis / snap-points-2d Goto Github PK

View Code? Open in Web Editor NEW
13.0 5.0 1.0 31 KB

Hierarchically snap round a set of 2d points for optimizing level of detail rendering in WebGL

License: MIT License

JavaScript 100.00%

snap-points-2d's Introduction

snap-points-2d

Runs iterative snap rounding on a set of 2D coordinates to produce a hierarchical level of detail for optimizing online rendering of huge 2D plots.

Install

npm i snap-points-2d

API

{levels, ids, weights, points} = require('snap-points-2d')(points, bounds?)

Reorders the points hierarchically such that those which are drawn at the same pixel coordinate are grouped together.

Inputs
  • points is an input array of 2*n coordinate values. It is kept untouched.
  • bounds is an optional array of 4 bounding box values of the points.
Outputs
  • points is an output float64 array with reordered an normalized to bounds point values.
  • ids is an output uint32 array which gets the reordered index of the points.
  • weights is an output uint32 array of point weights (number of points at the same pixel), which can be used for transparent rendering.
  • levels is an array of LOD scales. Each record is an object with the following properties:
    • pixelSize the pixel size of this level of detail in data units
    • offset the offset of this lod within the output array
    • count the number of items in the lod

License

(c) 2015 Mikola Lysenko. MIT License

snap-points-2d's People

Contributors

dy avatar mikolalysenko avatar

Stargazers

 avatar Faded Weiss avatar mrjj avatar David Dias avatar Olivia Jack avatar  avatar Chan avatar Alexander Milevski avatar etpinard avatar Michael Anthony avatar timelyportfolio avatar Athan avatar Anand Thakker avatar

Watchers

 avatar timelyportfolio avatar James Cloos avatar Michael Anthony avatar Jack Parmer avatar

Forkers

mcanthony

snap-points-2d's Issues

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.