Skip to content

spirometaxas/dragon-curve-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dragon-curve-cli

Print the Dragon Curve to the console!

What dragon-curve-cli prints to the console

npm version bundle size downloads license

Why the console? Because it's the cool way.

See All Fractals in the fractals-cli project.

Usage

Via npx:

$ npx dragon-curve-cli <n>
$ npx dragon-curve-cli <n> [options]

where n >= 0.

Via Global Install

$ npm install --global dragon-curve-cli
$ dragon-curve-cli <n>
$ dragon-curve-cli <n> [options]

where n >= 0.

Via Import

$ npm install dragon-curve-cli

then:

const dragon_curve = require('dragon-curve-cli');
console.log(dragon_curve.create(<n>);
console.log(dragon_curve.create(<n>, { 
    inverse: <boolean>,
    rotation: <left|right|flip|standard>,
    line: <bold|double|standard> 
});

The config params are optional.

Options

Recursive Step

$ dragon-curve-cli <n>

The first param <n> is the recursive step. <n> should be an integer greater than or equal to 0.

Examples:

$ dragon-curve-cli 7

What dragon-curve-cli prints to the console

$ dragon-curve-cli 9

What dragon-curve-cli prints to the console

Inverse

$ dragon-curve-cli <n> --inverse

The optional --inverse param (or shorthand -i) will draw the inverse Dragon Curve.

Example:

$ dragon-curve-cli 9 --inverse

What dragon-curve-cli prints to the console

Rotation

$ dragon-curve-cli <n> --rotate=<left|right|flip|standard>

The optional --rotate param rotates the Dragon Curve. Supported values:

  • left: Rotate left 90 degrees
  • right: Rotate right 90 degrees
  • flip: Rotate 180 degrees
  • standard: No rotation (default)

Example:

$ dragon-curve-cli 9 --rotate=right

What dragon-curve-cli prints to the console

$ dragon-curve-cli 9 --rotate=flip

What dragon-curve-cli prints to the console

$ dragon-curve-cli 9 --rotate=left

What dragon-curve-cli prints to the console

Line Type

$ dragon-curve-cli <n> --line=<bold|double|standard>

The optional --line param draws the Dragon Curve using different line types. Supported values:

  • bold: Draw using bold lines
  • double: Draw using double lines
  • standard: Draw using standard lines (default)

Examples:

$ dragon-curve-cli 9 --line=bold

What dragon-curve-cli prints to the console

$ dragon-curve-cli 9 --line=double

What dragon-curve-cli prints to the console

Related

Main Project

Fractal Shapes

Fractal Patterns

Space Filling Curves

License

About

Print the Dragon Curve to the console!

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published