Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/iam-medvedev/sierpinski-generator
Sierpiński triangle dataset generator.
https://github.com/iam-medvedev/sierpinski-generator
dataset fractal fractal-algorithms generator javascript sierpinski sierpinski-carpet sierpinski-triangle typescript
Last synced: 25 days ago
JSON representation
Sierpiński triangle dataset generator.
- Host: GitHub
- URL: https://github.com/iam-medvedev/sierpinski-generator
- Owner: iam-medvedev
- License: wtfpl
- Created: 2023-01-25T05:36:33.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-01-26T10:26:15.000Z (almost 2 years ago)
- Last Synced: 2024-09-16T00:31:10.376Z (about 2 months ago)
- Topics: dataset, fractal, fractal-algorithms, generator, javascript, sierpinski, sierpinski-carpet, sierpinski-triangle, typescript
- Language: TypeScript
- Homepage: https://iam-medvedev.github.io/sierpinski-generator/
- Size: 1.31 MB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# `sierpinski-generator`
[Sierpiński triangle](https://en.wikipedia.org/wiki/Sierpi%C5%84ski_triangle) dataset generator.
See interactive svg-generator [demo](https://iam-medvedev.github.io/sierpinski-generator/).
## Install
```sh
yarn add sierpinski-generator
```## Triangle generator
Usage:
```ts
import { createSierpinskiTriangle } from 'sierpinski-generator';const result = createSierpinskiTriangle({
size: 1000,
iterations: 4,
});// [
// {
// box: { width: 62.5, height: 62.5, x: 0, y: 0 },
// points: [
// { x: 0, y: 0 },
// { x: 62.5, y: 0 },
// { x: 31.25, y: 62.5 },
// ],
// },
// {
// box: { width: 62.5, height: 62.5, x: 62.5, y: 0 },
// points: [
// { x: 62.5, y: 0 },
// { x: 125, y: 0 },
// { x: 93.75, y: 62.5 },
// ],
// },
// ...
// ];
```## Carpet generator
Usage:
```ts
import { createSierpinskiCarpet } from 'sierpinski-generator';const result = createSierpinskiCarpet({
size: 1000,
iterations: 4,
});// [
// { width: 333.3333333333333, height: 333.3333333333333, x: 0, y: 0 },
// { width: 333.3333333333333, height: 333.3333333333333, x: 0, y: 333.3333333333333 },
// ];
```## Local demo
```sh
yarn demo
```## License
`sierpinski-generator` is [WTFPL licensed](./LICENSE).