日本語English
← Origami and Mathematics

Technical notes

The diagrams and numerical values use the same geometry functions. The mathematics code is collected in src/core.js and embedded in the HTML at build time. Crease pattern data is also embedded in the HTML. The diagrams use no external libraries or network requests.

Coordinates and reflection

The square is [0,1]×[0,1], with x increasing to the right and y upward. A line is represented by a point c on it and a unit direction vector u. Reflection and rotation are calculated using the projection f.

f = c + u(u·(p−c))
p′ = 2f−p
Point during rotation = (fₓ+vₓ cosβ, fᵧ+vᵧ cosβ, s sinβ)

Here v=p−f, and s is the signed distance from the crease. The rotation angle is β. At π, the result equals the reflection. The diagram's oblique projection adds depth to the vertical screen coordinate. Rotating about the crease gives the three-dimensional coordinates of the paper's faces.

Haga's intersection

Set P=(1−a,1) and the bottom right corner R=(1,0). Calculate the crease as the perpendicular bisector of PR. Q is the intersection of the reflected bottom edge with x=0.

Q = (0, (1−a)/(1+a))
1−Qᵧ = 2a/(1+a)

The test inputs are a=0.25, 0.5, 0.75. The respective results are 0.4, 2/3, 6/7. The tests check both the fraction formula and the intersection of the reflected edge.

Real roots for folding operations

Operations 1–5 and 7 use geometric formulas based on engine/axioms.js and engine/geom.js. For Operation 6, scanning a finite interval was replaced by directly finding the real roots of a polynomial of degree at most three.

Let the destination of point p be q(t)=c+tu, with v=q−p and D=v·v. Reflecting another point b gives b′=b−Wv/D, where W=2(b−p)·v−D.

cross(w,b−d)D − W cross(w,v) = 0

The target line is d+sw. D and W have degree at most two, and cross(w,v) has degree at most one. The full equation therefore has degree at most three. The derivative's real roots divide the search into intervals. Each interval with a sign change is bisected. Repeated roots where an extremum is zero are included as well. Finally, both reflected points are checked against their target lines again.

Details — numerical methods

The geometric tolerance is 10⁻⁹. Candidate creases for Operation 6 are checked with a distance tolerance below 10⁻⁷. Each polynomial coefficient is divided by the largest absolute coefficient. If the leading coefficient is below 10⁻¹³ in absolute value, the degree is reduced. Bisection runs for 100 iterations per interval. A bound calculated from the coefficients limits the root search.

Duplicate candidate lines are removed. If a point already lies on its target line, creases through that point are checked too. When coincident inputs do not uniquely specify a crease, only a finite set of candidates is shown.

Abe's trisection and Messer's ratio

Abe's diagram uses h=0.2, O=(0,0), B=(0,2h). The angle θ ranges from 40° to 85°. Set φ=θ/3 and calculate O′=(h cotφ,h). The crease is the perpendicular bisector of OO′.

tanθ = (3u−u³)/(1−3u²), u=tanφ

Independent checks verify that O reflects onto y=h and B onto the side at angle θ. The angle calculated from O′ is also compared with θ/3.

Messer's diagram uses O=(0,0), B=(0,1/3), O′=(1,u), u=1/(1+∛2). The tests check the simultaneous conditions that O reaches x=1 and B reaches y=2/3.

3u³−3u²+3u−1=0
((1−u)/u)³=2

Vertices and face order

Sort the mountain and valley crease directions by angle. Calculate the gaps between successive creases, including the gap back to the first. Add the alternating angles to form two sums. An even number of creases with both sums equal to π satisfies Kawasaki's condition. An absolute difference of two between mountain and valley counts satisfies Maekawa's condition.

To check assigned folds, find an angle smaller than its neighbors with a mountain fold on one side and a valley fold on the other. Remove those creases, combine the neighboring angles, and repeat the test. Each sector is reflected across successive creases to draw the overlapping faces.

The crane uses vertices, edges, mountain/valley assignments, faces, and overlap order from data/tsuru_final.json. Signed face areas in the crease pattern and folded state determine each face's orientation. Multiplying the signs in faceOrders by this orientation gives the order from bottom face to top face.

Results for 150 models are in data/theorem_check.json. Excluding boundary vertices, the results count how many of the 3,654 interior vertices satisfy Kawasaki's and Maekawa's conditions. The on-screen angles for the crane's 54 vertices use the same original coordinates.

Details — checking the test results

tools/check_theorems.py examines the boundary, mountain/valley assignments, and fold angles to collect interior vertex results. tools/check_negative.py tests changing one mountain/valley assignment and rotating a crease direction by about 1.7°. The recorded results show that all 3,654 vertices fail the corresponding condition in each test. The numerical tests recalculate the totals from the included results and the crane's coordinates.

Narrow strips

The example uses interval lengths [3,1,2,3]. With mountain–valley–mountain assignments, the creases on either side of the interval of length 1 form a crimp. The remaining lengths are [4,3]. Folding the end of length 3 removes the last crease. With mountain–mountain–mountain assignments, neither a crimp nor an end fold is possible.

After a crimp, the merged length is l_left+l_right−l_middle. The upper strip shows the original intervals and assignments. The lower cross section draws horizontal lines over the x ranges calculated by reflection, spacing the layers evenly. Semicircles join them at the creases: red for mountain folds and blue for valley folds. At each step, all 24 orders of the four intervals are checked. The diagram selects an order that matches the assignments without intersections between lines or semicircles. Unfolded neighboring intervals join at the same height. Step 0 shows one straight line. After the crimp, there are three layers and an unfolded remainder. After the end fold, there are four layers. For the mountain–mountain–mountain example, checking all 24 orders with every crease folded gives no orders that match the assignments without intersections. The diagram and foldability test use the same interval lengths.

Thickness and circle placement

Gallivan's formula takes thickness t in mm. The displayed length L is converted to m. The initial thicknesses are 0.02 mm for thin paper and 0.10 mm for thick paper. Both are assumptions for the calculation, rather than product measurements. The slider also adjusts thickness.

L = (πt/6)(2ⁿ+4)(2ⁿ−1)

At each fold in half, the cross section reverses the moving faces' top-to-bottom order to calculate the new layer order. Semicircles connect parts that were adjacent in the original sheet. When there are too many lines to display, the diagram selects layers connected to the larger bends. Layer heights and semicircle radii come from the calculated layer order.

The circle layout uses a tree branching from a single center. Circle i has radius rᵢ, the branch length. A distance of at least rᵢ+rⱼ between centers satisfies the corresponding tree distance constraint. Selecting Next once runs 12 updates that separate overlapping circles and move them inside the square. The score is the sum of squared distance shortfalls calculated from the centers. This method does not guarantee a minimum. Values below 10⁻⁶ are treated as zero when deciding whether to report that all circles fit without overlaps. Values are shown to three decimal places. Nonzero values below 0.001 use scientific notation with three significant figures.

In Sections 5 and 9, the circle's diameter at Step 0 fixes the diagram's height. Scale and center stay the same at every step, including intermediate folds and the outline after cutting and unfolding.

Reflections in fold-and-cut

Use 10 sectors of angle π/5. Fold in half along a diameter, then fold along lines at angles 2π/5, 4π/5, 3π/5 in that order. The 10 layers stack in a sector of angle π/5. Let the cut's unit normal be n=(cosγ,sinγ), with cut line n·p=0.55. Coordinates within the sector give the intersections with its sides. The drawn cut is rotated by 3π/5 to align with the folded sector.

p(β) = 0.55(cosβ,sinβ)/cos(β−γ)
β = 0, π/5

Trace each sector's creases in reverse order to reflect the cut back onto the original paper. Tests check that the 10 segments join and have equal lengths. At γ=π/5, neighboring segments line up to form a regular pentagon. The cut paper unfolds by reversing the same reflections.

Explicit formulas for the Miura fold

The diagram uses side lengths a=b=1, acute angle α=π/3, and four faces in each direction. The fold parameter θ ranges over 0≤θ≤α. The following formulas give every vertex directly, without repeatedly aligning individual faces.

X=a cosθ, H=a sinθ
S=b cosα/cosθ, Y=√(b²−S²)
vᵢⱼ=(iX+(j mod 2)S, jY, (i mod 2)H)

The horizontal edge vectors are (X,0,±H), and the vertical edge vectors are (±S,Y,0). Their lengths are a and b, respectively. The absolute value of their dot product stays constant at XS=ab cosα. Each quadrilateral lies in the plane spanned by these two vectors. Its face stays flat, and its side and diagonal lengths remain unchanged.

The width is 4X+S, depth is 4Y, and height is H. After rotating the view, faces are drawn from back to front using their average depth. Valley folds are dashed blue lines; mountain folds are solid red lines. At each interior vertex, the mountain-to-valley ratio is three to one or one to three.

Build and tests

The Japanese text is written in src/index.html and src/notes.html. tools/build.py embeds the mathematics code and JSON. It uses the included BudouX Japanese model to add possible line breaks at text boundaries. The build needs no additional external packages.

python3 math/tools/build.py
node math/tests/core.test.mjs
node math/tests/page.test.mjs

The mathematics tests check distances, conditions on reflected points, intersections, real roots of cubic equations, and the Miura fold's side lengths, diagonals, and face planarity. Page tests check for external network calls, verify embedded data, and test each diagram's initial display and button behavior.