User:Thijshijsijsjss/Pen Plotting Panache/Plotillism Experiments: Difference between revisions

From XPUB & Lens-Based wiki
m (Add link aliases)
m (Remove redundant whitespace)
 
(4 intermediate revisions by the same user not shown)
Line 12: Line 12:


Moreover, using points we can easily generate the HPGL code through the script, so that we don't have to resort to other programs for conversion steps.
Moreover, using points we can easily generate the HPGL code through the script, so that we don't have to resort to other programs for conversion steps.


==Different pointillism strategies==
==Different pointillism strategies==
Line 33: Line 32:
tl;dr stippling technique based on involved mathematical operations, that results in a nicely weighted distribution of points.
tl;dr stippling technique based on involved mathematical operations, that results in a nicely weighted distribution of points.


====Streategy====
====Strategy====
Todo
# Randomly place N seed points on your canvas
# Create the [https://en.wikipedia.org/wiki/Delaunay_triangulation Delaunay diagram] for these seed points: the unique triangulation such that the no triangles circumcircle contains any points)
# Create the [https://en.wikipedia.org/wiki/Voronoi_diagram Voronoi diagram] for these seed points: polygons that represent the areas that contain all coordinates that share the seed point they're closest to. This is the [https://en.wikipedia.org/wiki/Dual_graph dual graph] of the Delaunay diagram (i.e. the vertices in the Voronoi diagram are the centers of the Delaunay circumcircles).
# Apply [https://en.wikipedia.org/wiki/Lloyd%27s_algorithm Lloyd's Algorithm (Voronoi iteration)] by iteratively moving the seed points to the centers of the Voronoi polygons. This can be approximated by the average of the polygon vertices, or better yet be calculated ([https://paulbourke.net/geometry/polygonmesh/ see Paul Burke's reference]).
# Use these relaxed points for 'pointillism'
 
Note: for our purposes, we don't simply want to relax all points. This would ultimately lead to a uniform distribution. Instead, we want to base the relaxation on the brightness values of the image we feed in.


====Resources====
====Resources====
* [https://www.cs.ubc.ca/labs/imager/tr/2002/secord2002b/secord.2002b.pdf Paper introducing Weighted Voronoi Stippling]
* [https://www.cs.ubc.ca/labs/imager/tr/2002/secord2002b/secord.2002b.pdf Paper introducing Weighted Voronoi Stippling]
* [https://thecodingtrain.com/challenges/181-image-stippling Coding Train tutorial and reference code (p5.js using D3)]
* [https://thecodingtrain.com/challenges/181-image-stippling Coding Train tutorial and reference code] ([https://p5js.org/ p5.js] using [https://d3js.org/ D3 library])
 
==Plotting through PowerShell==
Previously, I have been pen plotting mainly through Inkscape on Windows. Now that the plotillism script outputs HPGL, I will need to use the terminal! On my Linux setup, this is straightforward <code>cat "my hpgl" > /dev/ttyUSB0</code> (for example). PowerShell is more involved:
 
$port= new-Object System.IO.Ports.SerialPort COM6,4800,None,8,one
$port.open()
$port.Write(string text)
$port.Close()
 
(see also [https://stackoverflow.com/questions/48611163/powershell-write-value-to-serial-port this stack exchange post])

Latest revision as of 12:56, 13 May 2024

For a while now, Victor and I have been talking about pen plotted pointillism. Last week, Manetta shared an open call on Zulip that displays some nice pointillism examples: https://ligne.page/en/les-ressources/long-distance-drawing. Seeing this, I was prompted again to develop this idea further.

This wikipage will be somewhat of an experiment itself. Instead of the 'postmortem' style where I document a final working script (e.g. Plothatching), I will instead try to document the steps of experimentation and exploration while forming this project.

Initial idea: adapt crosshatching technique

We have made many plots using a crosshatching technique (see for example here). This techniques works as follows:

  1. decide on a number of layers L
  2. divide the image into L different areas based on the brightness levels of the pixels
  3. create L layers with lines, each with its own rotation, and mask each one with one of the areas above

Instead of lines, we could use points as well. In its most basic format, this is a simplification of the crosshatching technique: instead of drawing lines, we could draw points. It is a simplification, because we would not necessarily need to rotate these layers. In fact: everything could be one layer.

Moreover, using points we can easily generate the HPGL code through the script, so that we don't have to resort to other programs for conversion steps.

Different pointillism strategies

Converting the crosshatching script to use points instead of lines would be relatively easy. However, the longer I thought about this project, the more I felt like this should really be stochastic pointillism:

Pixel loop

tl;dr: loop over pixels and compare brightness value to a random nr to determine if there should be a point there Too gridlike

Dart Throwing

tl;dr throw D darts and compare brightness value to a random br to determine if there should be a point there still to gridlike

ChatGPT inquiries

Screentone

tl;dr deterministic; similar to crosshatching; offset layers of points

Weighted Voronoi Stippling

tl;dr stippling technique based on involved mathematical operations, that results in a nicely weighted distribution of points.

Strategy

  1. Randomly place N seed points on your canvas
  2. Create the Delaunay diagram for these seed points: the unique triangulation such that the no triangles circumcircle contains any points)
  3. Create the Voronoi diagram for these seed points: polygons that represent the areas that contain all coordinates that share the seed point they're closest to. This is the dual graph of the Delaunay diagram (i.e. the vertices in the Voronoi diagram are the centers of the Delaunay circumcircles).
  4. Apply Lloyd's Algorithm (Voronoi iteration) by iteratively moving the seed points to the centers of the Voronoi polygons. This can be approximated by the average of the polygon vertices, or better yet be calculated (see Paul Burke's reference).
  5. Use these relaxed points for 'pointillism'

Note: for our purposes, we don't simply want to relax all points. This would ultimately lead to a uniform distribution. Instead, we want to base the relaxation on the brightness values of the image we feed in.

Resources

Plotting through PowerShell

Previously, I have been pen plotting mainly through Inkscape on Windows. Now that the plotillism script outputs HPGL, I will need to use the terminal! On my Linux setup, this is straightforward cat "my hpgl" > /dev/ttyUSB0 (for example). PowerShell is more involved:

$port= new-Object System.IO.Ports.SerialPort COM6,4800,None,8,one
$port.open()
$port.Write(string text)
$port.Close()

(see also this stack exchange post)