Socket
Book a DemoInstallSign in
Socket

block-fractal

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

block-fractal

Generates a blocky fractal-like shape, like a tile-based randomized koch curve

2.0.2
latest
Source
npmnpm
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

BlockFractal

Dependencies Node.js CI License

Generates a blocky fractal-like shape, like a tile-based randomized koch curve

See the demo

Example Result

Installation

npm install block-fractal

Usage

Create a block fractal:

const BlockFractal = require('block-fractal');

const path = BlockFractal.makeBlockFractal({
    iterations: 7
});

Convert the path into a set of raster lines (makes cell tests faster):

const mask = path.rasterize();

Test if a tile is in the shape:

const inside = mask.get(x, y);

...

Details

BlockFractal starts with a "seed" shape, which by default is a 2x2 square:

Example 1

The shape is doubled, and then each edge is either left in place or moved to one side or the other:

Example 10

The result is a new, bigger shape, similar to the previous shape but with a more varied border:

Example 13

That process is then repeated as many times as requested.

For more information, see the Algorithm Overview

Keywords

fractal

FAQs

Package last updated on 23 Aug 2021

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

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.