Skip to content

A Hermite data visualization tool for rabbit-hole and three.

License

Notifications You must be signed in to change notification settings

vanruesc/hermite-data-helper

Repository files navigation

Hermite Data Helper

Build status npm version Peer dependencies

A Hermite data visualization tool for rabbit-hole and three.js.

API Reference

Installation

This library requires the peer dependency three.

npm install three hermite-data-helper

Usage

import { Scene, Vector3 } from "three";
import { HermiteData } from "rabbit-hole";
import { HermiteDataHelper } from "hermite-data-helper";

const scene = new Scene();
const data = new HermiteData();
const cellPosition = new Vector3();
const cellSize = 1;

const hermiteDataHelper = new HermiteDataHelper(cellPosition, cellSize, data);

// Render the helper.
scene.add(hermiteDataHelper);

// Access special geometry subgroups.
console.log(hermiteDataHelper.gridPoints);
console.log(hermiteDataHelper.edges);
console.log(hermiteDataHelper.normals);

// Use a different cell size, position and data set.
hermiteDataHelper.set(otherPosition, otherSize, otherData);

try {

	// Destroy the helper geometry and rebuild grid points and edges.
	hermiteDataHelper.update(true, true);

} catch(e) {

	// The provided position, size or data is invalid.

}

// Destroy the helper geometry.
hermiteDataHelper.dispose();

A full example can be found here.

Contributing

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