Socket
Book a DemoInstallSign in
Socket

sparse-octree

Package Overview
Dependencies
Maintainers
1
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sparse-octree

A sparse octree data structure for three.js.

Source
npmnpm
Version
0.1.2
Version published
Weekly downloads
361
-61.02%
Maintainers
1
Weekly downloads
 
Created
Source

Sparse Octree

Build status npm version Dependencies

A sparse octree data structure for three.js. Sparse octrees can have empty nodes. Nodes that aren't empty can either have children themselves or they can be leaf nodes that contain point data.

This octree doesn't support moving objects and its focus lies on managing point data. Support for triangles and dynamic updates is planned, but has low priority.

Preface

This module uses modern ECMAScript features and requires one of the following browsers:

  • Chrome ≥ 42
  • Firefox ≥ 45
  • IE Edge ≥ 13

Semantic versioning is used in this module to indicate whether an update introduces breaking changes. However, backwards-compatibility regarding ECMAScript versions is entirely neglected in favor of cleaner code and development convenience.

Installation

$ npm install sparse-octree

Usage

// Attention: Three is not yet an ES6 module!
import {
  WebGLRenderer, Scene, PerspectiveCamera,
  Points, PointsMaterial, BoxBufferGeometry, Box3
} from "three";

import { Octree, OctreeHelper } from "sparse-octree";

let renderer = new WebGLRenderer();
let scene = new Scene();

let camera = new PerspectiveCamera();
scene.add(camera);

let points = new Points(
  new TorusKnotBufferGeometry(1, 1, 64, 64),
  new PointsMaterial({
    color: 0xffffff, size: 1, sizeAttenuation: false
  })
);

scene.add(points);

let bbox = new THREE.Box3();
bbox.setFromObject(scene);

let octree = new Octree(bbox.min, bbox.max, 0.0, 8, 8);
octree.addPoints(points.geometry.getAttribute("position").array, points);

scene.add(new OctreeHelper(octree));

(function render(now) {

  requestAnimationFrame(render);
  renderer.render(scene, camera);

}());

Demo

Octree Raycasting

Documentation

API

Contributing

Maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code.

License

Zlib

Keywords

3d

FAQs

Package last updated on 04 Jun 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