gomjau-hogg
TypeScript icon, indicating that this package has built-in type declarations

0.0.13 • Public • Published

This is a FORK of the original Antwerp.

The original Antwerp can be found on Github.

The major differences are:

  • the original Antwerp has a better demo
  • runs optimally in O(n); original runs in O(n^3) (where n is the number of tiles)
  • 🔥blazingly fast🔥 - under a micro-second per tiled shape

ANTWERP

Application for Nets and Tessellations With Edge-to-edge Regular Polygons

A web application for visualising the GomJau-Hogg notation for generating any regular polygon tessellations.

Installation

npm install gomjau-hogg

Usage

import { toShapes } from 'gomjau-hogg';

// Any tesselation in GomJau-Hogg notation
const configuration = '6-4-3,3/m30/r(h1)';

// transformation repetition count ~ c*sqrt of number of shapes tiled,
// e.g. `15` results in `1099` tiles for the above configuration
const repeatCount = 15;

// size of sidelength of shapes
const shapeSize = 25;  

const data = toShapes(configuration, repeatCount, shapeSize);

// `data` will be:
{
    maxStage: 9,
    maxStagePlacement: 4,
    shapes: [
        {
          "sides": 6,  // number of sides of shape -> hexagon in this case
          "stage": 0,  // transformation stage -> 0 means seed placement
          "stagePlacement": 1,  // stage within each transformation - can be used for coloring
          "θm": -6,    // the rotation angle of the shape in 𝜋/12 increments
          "c": [0,0]   // shape centroid
        },
        { "sides": 4, "stage": 0, "stagePlacement": 2, "θm": 16, "c": [ 13.660254037844375, 23.660254037844393 ] },
        ...
    ],
    transformPointsMaps: [Map(...)]  // map of transform points
}

To get the actual vertices of a shape just call:

const { c, θm, sides } = shape;
fromCentroidAndAngle(c, θm, sides, shapeSize);  //=> array of points, i.e. `points: number[][]`

Demo Notes

The demo has been hacked from the original and for the purpose of testing the library so lots of functionality has been removed mostly because I struggled (and didn't have the time) getting things (mostly the newest version of React Router and preshape) working but it's relatively easy to fix all the shortcomings.

Most notably:

Package Sidebar

Install

npm i gomjau-hogg

Weekly Downloads

185

Version

0.0.13

License

MIT

Unpacked Size

2.34 MB

Total Files

283

Last publish

Collaborators

  • florissteenkamp