Skip to content

FoobarProtocol/binvox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 © 2023 James Edwards

BINVOX is licensed under the MIT License.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published