Flat torusx across, y up
drag orbitright-drag panwheel zoom to cursorclick pin a pointdbl-click fly to itS shape? all keys

How the torus works

Both coordinates of a point on y² = x³ + ax + b live in Fp = {0, …, p−1} and wrap around at p, so the plane Fp × Fp is already a torus. The view wraps x once around the hole (u = 2π·x/p) and y once around the tube (v = 2π·y/p). The flat map is the same square with opposite edges glued.

Negation keeps x and sends y to p − y, so −P is the mirror image of P through the equatorial plane. P and −P always share a meridian ring. The point at infinity 𝒪 has no coordinates and is never drawn.

The chord through P₁ and P₂ is the line y ≡ λx + c (mod p). On the torus that line winds once around the hole and λ times around the tube (λ taken in (−p/2, p/2]); it meets the curve a third time at R = −(P₁ + P₂), and reflecting R gives the sum. For 256-bit curves the winding is astronomically large, so only the three points and the mirror step are drawn.

With a = 0 and p ≡ 1 (mod 3) there is a cube root of unity β, and (x, y) ↦ (βx, y) maps the curve to itself. On secp256k1 that is multiplication by λ, the GLV endomorphism; the three points sharing a y lie on one parallel ring.

Step (N) puts the result into P₁, so the operation runs again from there: with P₁ = P₂ = G it walks G, 2G, 3G, … around the surface, and with 2·P₁ it walks the doublings. Scalars stay readable (5G) whenever the page knows them.

Shapes

The Shape section (S) wraps the same points onto other surfaces, and the surface morphs from one to the next. The lemniscate and trefoil tubes are still tori, bent into a figure-eight or tied into a (2, 3) knot, so everything carries over. A knot is chiral: no mirror maps it onto itself, so on the trefoil −P is P reflected inside its own ring (across the plane of the knot's direction and the torus normal there) rather than through one plane. The cylinder, sphere, ellipsoid, icosahedron and wavy plane cut the torus open at y ≈ p/2: y is centred, so y = 0 lies on the mirror plane and P and −P stay mirror images, but rings and the chord break where they cross the cut. The icosahedron carries the sphere map pushed out radially onto its faces. The Klein bottle closes up in y but glues its x seam with a twist, y ↦ p/2 − y, so lines break there; it has no outside and is drawn from both sides. On the wavy plane negation mirrors through the upright plane along its middle.

Mouse and touch

drag
orbit around the axis
right-drag / shift+drag
pan
wheel / pinch
zoom toward the cursor
hover
details card stays until you hover another point, click empty space or press Esc
click a point
pin its card (pin as many as you like)
dbl-click a point
fly to it
toolbar
views, reset, auto-rotate, full screen, PNG, JSON and a link to this state, on the left of the view

Keys

1 2 3
oblique, top and side views
R
reset camera
F
fly to the inspected point
Space
auto-rotate
N
step: P₁ ← the result
G L C K B M
grid, labels, curve points, chord, β-orbit, flat map
S Shift+S
next or previous shape
T
dark or paper theme
\
hide or show the panel
Esc
drop the hover card, then the pins
Enter in a field
plot

Input formats

02… 03…
compressed SEC (y even / odd)
04…
uncompressed SEC; drawn even when off the curve, flagged in red
06… 07…
hybrid keys, parity bit checked against y
32-byte hex
x-only (BIP340 lift_x, even y)
(x, y)
affine pair, decimal, hex or expressions
5G (n-1)G λG
scalar multiples of G; n is the order of G when known
O
the point at infinity

Power tools

console
ecTorus.model is the computed state; ecTorus.engine holds Curve, parsePoint, evalExpr, sqrtMod, dlog and friends; ecTorus.set({ p1: '7G' }) drives the page
URL
?lines=thin draws the grid with hairlines (picked automatically on software WebGL), ?lines=fat forces thick lines
Copy link
encodes the whole state after #s=, panel layout included, so a link reopens the exact view

Project

source
github.com/idlebg/EllipticTorus3d: code, tests and releases, MIT licence
gallery
idlebg.com/idleGevrek: eighteen ready-made states, each opening this page exactly there, and a tour video