Socket
Socket
Sign inDemoInstall

knotess

Package Overview
Dependencies
1
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    knotess

Tessellate mathematical knots in JavaScript


Version published
Maintainers
1
Install size
2.70 MB
Created

Readme

Source

Knotess

badge

This library generates triangle meshes for all the prime knots in the Rolfsen table.

At run time, knotess consumes a compact binary file (centerlines.bin) containing bézier control points. It then generates triangle meshes by sweeping a polygon along the bézier curves.

Example

const SPINEDATA = 'centerlines.bin';
fetch(SPINEDATA).then(res => res.arrayBuffer()).then((data) => {
    const knots = new Knotess(data);
    const link = knots.tessellate('7.2.3');
    const mesh = link[0];
    const nverts = mesh.vertices.length / 6; // positions and normals
    console.info(`The first component has ${nverts} vertices.`);
});

Install

Install with NPM (npm install knotess) or Yarn (yarn add knotess), then:

import Knotess from 'knotess';

Or use one of the following two CDN builds.

<script src="//unpkg.com/knotess@1.1.2/knotess.min.js"></script> <!-- minified build -->
<script src="//unpkg.com/knotess@1.1.2/knotess.js"></script> <!-- dev build -->

API Reference

new Knotess(ArrayBuffer)

Constructs a tessellator given a flat array of floating-point XYZ coordinates for the knot centerlines.

knotess.tesselate(string, options)

Given an Alexander-Briggs-Rolfsen identifier and an optional configuration dictionary, returns an array of "meshes" where each mesh is a dictionary with three entries: a Float32Array vertex buffer, a Uint16Array triangle buffer, and aUint16Array wireframe buffer.

Knotess.LinksDb

Dictionary from Alexander-Briggs-Rolfsen number (e.g. "2.2.1") to arrays of two-tuples, where each two-tuple defines a range within the centerlines buffer. In knot theory parlance, each two-tuple corresponds to a component and each entry in the dictionary corresponds to a link.

Knotess.Rolfsen

Array of strings where each string corresponds to a row in the Rolfsen table. Each string is a space-delimited list of Alexander-Briggs-Rolfsen identifiers.

Keywords

FAQs

Last updated on 02 Nov 2018

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc