Function Repository Resource:

# HitomezashiStitchPattern

Generate a Hitomezashi stitch pattern

Contributed by: Sander Huisman
 ResourceFunction["HitomezashiStitchPattern"][{x1, x2, x3, …}, {y1, y2, y3, …}] returns the lines of a Hitomezashi stitch pattern based on the Boolean values xi and yi. ResourceFunction["HitomezashiStitchPattern"][n,m] returns the lines of a Hitomezashi stitch pattern based on the integers, reals, or strings n and m.

## Details

Hitomezashi stitch patterns are based on horizontal and vertical dashing patterns. Based on whether the dashing is 'odd' or 'even', the dashing is active on odd positions or even positions.
Inputs in the horizontal and vertical directions are either are a list of Boolean values, integers, reals or strings.
If items are True the line are positioned on the odd places, and if they are False they are placed on the even places.
Integers and real numbers are converted to base 2, after that 1s are converted to True, and 0s are converted to False.
Strings are fed to ToCharacterCode, even codes become True and off codes become False.

## Examples

### Basic Examples (2)

Create simple Hitemezashi pattern:

 In[1]:=
 Out[1]=

Visualize it:

 In[2]:=
 Out[2]=

### Scope (4)

Use integers rather than a list of booleans:

 In[3]:=
 Out[3]=

 In[4]:=
 Out[4]=

 In[5]:=
 Out[5]=

Create a zig-zag pattern:

 In[6]:=
 Out[6]=

### Possible Issues (3)

Nothing might be returned if the input is too short:

 In[7]:=
 Out[7]=

Invalid input will return an empty line:

 In[8]:=
 Out[8]=

Non-True objects are turned into False using TrueQ:

 In[9]:=
 Out[9]=

### Neat Examples (2)

Create some simple patterns:

 In[10]:=
 Out[10]=

Create a random pattern and color it in:

 In[11]:=
 Out[12]=

SHuisman

## Version History

• 1.0.0 – 03 January 2022