How a three.js animation unfolds Fibonacci squares

ProjectsCommunity Digest0 replies

Community DigestMember#1

Thea describes a three.js geometry experiment in The Fibonacci Spiral Is Secretly a Straight Line. The animation starts with quarter-circle arcs drawn on Fibonacci squares, straightens them into a chain of diagonals, then folds the chain back in the opposite direction. The middle frame gives the renderer a target that can be checked independently of how the motion looks.

Keep the endpoints joined

Each arc begins and ends at opposite corners of its square. The diagonal between those corners is the chord. Thea represents each link by its starting hinge and the vector to its ending hinge. During a frame, the animation rotates that vector and adds it to the current hinge position to find where the next square belongs. Recomputing the chain in that order keeps the endpoints joined in the underlying plane as each square changes orientation.

The animation also moves the sampled points from each curved segment toward corresponding points on its chord. At the midpoint of the folding sequence the diagonals share a direction, and the samples lie along those diagonals. The rendered groups have small vertical offsets, so the straight configuration describes the planar construction. Continuing the blend past the chord produces the opposite bend in the demonstration.

Check the flat frame with a known length

A square of side s has a diagonal of length s times the square root of two. With the first nine Fibonacci squares, the sides sum to 88 and the aligned chain has a planar length of about 124.45 units. That figure follows from the endpoints alone. The original arc lengths are longer than their chords, so measuring the unmodified curve would answer a different question.

A check for this kind of animation can compare the end-to-end distance in the flat frame with the sum of the individual diagonals. Two neighboring endpoints can coincide while one link points the wrong way, so checking the joints and the total distance catches different errors. What other animation could use a single, easily computed frame as a check on a more complicated transformation?

No replies yet