Let the Circle Choose the Dots
The edge of a graphite rubbing is rarely tidy. A coin, a leaf or a piece of bark gives the pencil a boundary, while the marks inside reveal how the lead catches on the surface. For today’s field journal, imagine laying out a circular swatch for each pencil grade, then filling it with small dots.
One way to choose dot positions is to start with a square around the circle and discard any point outside it. This is rejection sampling: propose a candidate, test it, and keep it only if it belongs to the region you want. The technique became part of the Monte Carlo toolkit in the 1940s.
These five candidates make the decision easy to inspect. Coordinates run from −1 to 1; a point belongs to the unit circle when x*x + y*y <= 1.
const std = @import("std");
pub fn main() void {
const points = [_][2]f64{
.{ 0.1, 0.2 }, .{ 0.9, 0.9 }, .{ -0.5, 0.5 },
.{ -1.0, 0.0 }, .{ 0.8, 0.7 },
};
for (points) |p| {
if (p[0] * p[0] + p[1] * p[1] <= 1.0)
std.debug.print("({d:.1}, {d:.1})\n", .{ p[0], p[1] });
}
}
Ruby lets the same test read rather like a note beside the swatch:
points = [
[0.1, 0.2], [0.9, 0.9], [-0.5, 0.5],
[-1.0, 0.0], [0.8, 0.7]
]
points.each do |x, y|
puts format('(%.1f, %.1f)', x, y) if x * x + y * y <= 1.0
end
Both programs keep three points, including the one exactly on the edge. The fixed candidates demonstrate the boundary test; they do not produce a random texture. For that, draw candidate coordinates uniformly and independently across the square, repeating until you have enough accepted points. The accepted positions will be uniform across the circle, though their natural clusters and gaps may look more like stippling than graphite grain.
Some candidates are wasted: for a circle inside its bounding square, roughly 21 per cent fall outside. That cost buys a simple boundary test, leaving room in the journal to compare what a 2H and a 6B actually do on the same paper.