Giter VIP home page Giter VIP logo

binvox's Introduction

BINVOX

Parser and builder for BINVOX voxel file format.

npm version Build Coverage Status Language grade: JavaScript

Specification of vox file format can be found here.

Documentation - Wiki

Table of Contents

Install

$ npm install --save binvox

Usage

Syntax

// Import via ES6 modules
import {Builder, Parser} from 'binvox';
// or UMD
const BINVOX = require('binvox');

Example

This Node.js example reads a BONVOX file and parses it:

const fs = require('fs');
const BINVOX = require('binvox');
 
fs.readFile('path/to/file.binvox', (err, data) => {
  if (err) throw new Error(err);
  const parser = new BINVOX.Parser();
  const result = parser.parse(data.buffer);
  console.log(result);
})

where data.buffer is an instance of ArrayBuffer.

It is recommended to read the official BINVOX specification, in order to understand the structure of the data.

The output consists of various file information, in addition to the actual voxel data:

{ 
  dimension: { depth: 32, width: 32, height: 32 },
  translate: { depth: 11.81, width: 21.39, height: -1.69 },
  scale: 30.206,
  voxels: [...]
}

voxels contain the actual voxel data (points), and looks like this:

[
  { x: 0, y: 2, z: 3 },
  { x: 0, y: 3, z: 3 },
  { x: 0, y: 4, z: 3 },
  ...,
]

where the index of each voxel is ordered by the voxel's "location in space".

API

License

Copyright © 2020 André Storhaug

BINVOX is licensed under the MIT License.

binvox's People

Contributors

andstor avatar

Watchers

 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.