Socket
Book a DemoInstallSign in
Socket

greedy-mesher

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

greedy-mesher

Greedy mesh compiler

latest
Source
npmnpm
Version
1.0.3
Version published
Maintainers
1
Created
Source

greedy-mesher

A flexible system for generating greedy meshes of ndarrays.

Example

var compileMesher = require("greedy-mesher")

var mesher = compileMesher({
  extraArgs: 1,
  order: [1, 0],
  append: function(lo_x, lo_y, hi_x, hi_y, val, result) {
    result.push([[lo_x, lo_y], [hi_x, hi_y]])
  }
})

var test_array = require("ndarray-pack")(
[[0, 2, 0, 0],
 [0, 1, 1, 0],
 [0, 1, 1, 0],
 [0, 0, 0, 0]])

var result = []
mesher(test_array, result)
console.log(result); 
// outputs: [ [ [ 1, 0 ], [ 2, 1 ] ], [ [ 1, 1 ], [ 3, 3 ] ] ]

Install

npm install greedy-mesher

require("greedy-mesher")(options)

This routine generates a greedy mesher for a given order and list of closures

  • order An array representing the order in which to mesh the input.
  • extraArgs The number of optional arguments to pass to each closure.
  • skip(a,...) A closure which tests if the given voxel should be skipped. (Default: skips 0)
  • merge(a,b,...) A closure which tests if voxels a and b can be merged in the mesh. (Default: checks if voxels are equal)
  • append(lo0, lo1, ..., lon, hi0, hi1, ..., hin, val, ...)
  • useGetter if set, use .get() to access underlying data store
  • debug If set, print out the generated source code to the console

Returns A compiled mesh generator. Call this method using:

var my_mesh = mesher(array, option1, option2, ...)

Credits

(c) 2013 Mikola Lysenko. MIT License

Keywords

greedy

FAQs

Package last updated on 12 Feb 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts