Monday, March 14, 2016

[byklrrhu] Guilloche

guilloche

Epicycles upon epicycles can generate guilloche patterns.  They are a superset of spirograph patterns.  Unlike spirograph, we do not constrain one circle to roll without slip on another circle; instead each circle can turn independently at an arbitrary specified speed.

guilloche :: [Epicycle] -> Double-> (Double, Double)
guilloche epicycles t = (f cos, f sin) where {
f :: (Double -> Double) -> Double;
f fn = sum $ map (\e -> radius e * fn (2*pi * velocity e * (t phase e))) epicycles;
};
radius, velocity, phase :: Epicycle -> Double;

If velocity and radius are allowed to differ by coordinate, then the curve becomes a fancy Lissajous curve instead of just a fancy circle.

If all the velocity are rational, then the curve is periodic, though the period may be very long.  The period is probably the least common multiple of the denominators.

What determines the symmetry of the full period pattern?  If all the phase angles are zero, then it has bilateral symmetry.  What else determines how pretty the pattern will be?

For rasterization, how closely should the time points be sampled?  Probably the reciprocal of the derivative of the function.

For linear interpolation, how closely should the time points be sampled?  Optimal is probably not equally spaced samples but higher density in areas of more curvature.  Calculating curvature is probably not too hard.  If plotting with higher order splines, where should the control points be?

There are many opportunities to optimize the computation.  Every point is independent, so the computation is embarrassingly parallel.  Maybe suitable for GPU.  We could also use recurrence relations to rapidly evaluate sine and cosine at evenly spaced points.  Maybe FFT (though probably not).

How can one accelerate the computation of a small zoomed-in section of a very long full period?

Given a raster quantized image of a small section of the full period of a guilloche pattern, determine its parameters.  This is the forger's problem.  Is this problem cryptographically difficult?

Add colors.  Easiest might be to have each epicycle contribute a different color component.  Or color regions like a checkerboard.

The radii and phase angles could be continuously adjusted to create an animation.

Some Haskell code to plot guilloche curves, including a few fancy features: computing the length of the full period with rational velocities, and computing the sampling interval for rasterization.  The code is very slow.

No comments :