% Append additional standalone figure environments below as needed.

\begin{figure}[tbp]
\centering
\begin{tikzpicture}[scale=0.82, line join=round, line cap=round]
\useasboundingbox (-5,-5) rectangle (5,5);
\appendlight[v = {return Vector:new{1, 1, 1, 1}}]
\def\SSS{3}
\setobject[
	name = view,
	object = {return Matrix.zyzrotation3(math.pi/2, math.pi/3, math.pi/6)}
]
\foreach \AlphaDeg/\BBB in {15/7,45/50,75/92} {
\setobject[
	name = a,
	object = {return \AlphaDeg*math.pi/180}
]
\setobject[
	name = R,
	object = {return 1/math.cos(a)}
]
\setobject[
	name = r,
	object = {return math.sqrt(math.abs(1/math.cos(a)^2) - math.abs(math.cos(a)))}
]
\appendsurface[
	ustart = {math.pi/2}, ustop = {-math.pi}, usamples = 20,
	vstart = 0, vstop = tau, vsamples = 50,
	transformation = {return view},
	v = {
		return Vector:new{r*math.cos(u)*math.cos(v), r*math.sin(u)*math.cos(v), r*math.sin(v), 1}
			:hadd(Vector:new{R*math.cos(u), R*math.sin(u), 0, 1})
	},
	filter = {
		local M = A:hadd(B):hadd(C):hscale(1/3):multiply(view:inverse())
		return math.abs(M[1]) < \SSS.001 and math.abs(M[2]) < \SSS.001 and math.abs(M[3]) < \SSS.001
	},
	fill options = {fill={gray!\BBB!black!50!ltdtbrightness}, fill opacity=1},
	curve = {
		local segments = {}
		local domain_origin = math.pi/2
		local branches = 7
		local samples_per_branch = 40
		local samples = branches*samples_per_branch
		local step = tau/samples
		local function append_segment(s0, s1)
			if s1 <= s0 then
				return
			end
			local wrap = math.floor(branches*s0/tau + 1e-9)
			local u0 = domain_origin - s0
			local u1 = domain_origin - s1
			local v0 = branches*s0 - wrap*tau
			local v1 = branches*s1 - wrap*tau
			table.insert(segments, {
				Vector:new{u0, v0},
				Vector:new{u1, v1},
				drawoptions = "draw=green!50!black, thick"
			})
		end
		for i = 0, samples - 1 do
			local s0 = i*step
			local s1 = s0 + step
			local wrap0 = math.floor(branches*s0/tau + 1e-9)
			local wrap1 = math.floor(branches*s1/tau + 1e-9)
			if wrap0 == wrap1 then
				append_segment(s0, s1)
			else
				local seam = (wrap0 + 1)*tau/branches
				append_segment(s0, seam)
				append_segment(seam, s1)
			end
		end
		return segments
	}
]
}
\appendsolid[
	ustart = -\SSS, ustop = \SSS, usamples = \SSS,
	vstart = -\SSS, vstop = \SSS, vsamples = \SSS,
	wstart = -\SSS, wstop = \SSS, wsamples = \SSS,
	transformation = {return view},
	filter = {return false},
	v = {return Vector:new{u, v, w, 1}}
]
\displaysimplices
\end{tikzpicture}

\caption{A still frame from a larger animated family. This manual version fixes
the configuration at a $15^\circ$ offset, keeps the shared view, and preserves
the seven-branch green parameter-space curve family on the three linked
surfaces.}
\end{figure}

\begin{figure}[tbp]
\centering
\begin{tikzpicture}[scale=0.9, line join=round, line cap=round]
\setobject[
	name = T,
	object = {
		return Matrix.zyzrotation3(math.pi/2, math.pi/3, 7*math.pi/6)
			:multiply(Matrix.translate3(0, 0, -5))
	}
]
\foreach \t in {1,2,3} {
\appendsurface[
	ustart = 0,
	ustop = 1,
	usamples = 18,
	vstart = 0,
	vstop = 1,
	vsamples = 9,
	v = {
		local s = Vector.sphere(Vector:new{u*tau, v*math.pi, 1})
		return Vector:new{
			2*math.cos(\t*tau/3) + s[1],
			2*math.sin(\t*tau/3) + s[2],
			\t/3 + s[3],
			1
		}
	},
	transformation = {
		return Matrix.zyzrotation3(\t*math.pi/12, \t*math.pi/12, \t*math.pi/12)
			:multiply(T)
	},
	fill options = {
		preaction = {
			fill = white
		},
		postaction = {
			draw,
			line cap = round,
			line join = round,
			ultra thin
		}
	}
]
}
\appendsurface[
	ustart = -1,
	ustop = 1,
	usamples = 4,
	vstart = -1,
	vstop = 1,
	vsamples = 4,
	v = {return Vector:new{4*u, 4*v, 1 + u, 1}},
	transformation = {return T},
	fill options = {
		preaction = {
			fill = blue
		},
		postaction = {
			draw,
			line cap = round,
			line join = round,
			ultra thin
		}
	}
]
\displaysimplices
\end{tikzpicture}

\caption{Three rotated spherical shells gather above a slanted plane, with a
shared rigid transform and per-shell spin producing the interlocked stack.}
\end{figure}

\begin{figure}[p]
\centering
\begin{tikzpicture}[scale=2.85, line join=round, line cap=round]
\setobject[
	name = T,
	object = {
		return Matrix.zyzrotation3(math.pi/2, math.pi/3, math.pi/6)
			:multiply(Matrix.translate3(0, 0, -5))
			:multiply(Matrix:new{
				{1, 0, 0, 0},
				{0, 1, 0, 0},
				{0, 0, 1, -1/4},
				{0, 0, 0, 1}
			})
	}
]
\setobject[
	name = I,
	object = {return T:inverse()}
]
\foreach \j/\shellfill in {3/blue,2/green,0/red,1/yellow} {
\appendsurface[
	ustart = -2,
	ustop = 2,
	usamples = 2,
	vstart = -2,
	vstop = 2,
	vsamples = 2,
	transformation = {
		return Matrix.zyzrotation3(\j - math.pi/4, 2*\j, \j):multiply(T)
	},
	v = {return Vector:new{u, v, 0, 1}},
	fill options = {
		preaction = {
			fill = \shellfill,
			fill opacity = 0.6
		},
		postaction = {
			draw = black,
			ultra thin,
			line join = round,
			line cap = round
		}
	},
	filter = {
		local AI = A:multiply(I):reciprocate_by_homogeneous()
		local BI = B:multiply(I):reciprocate_by_homogeneous()
		local CI = C:multiply(I):reciprocate_by_homogeneous()
		for axis = 1, 3 do
			if math.abs(AI[axis]) >= 1.01 then return false end
			if math.abs(BI[axis]) >= 1.01 then return false end
			if math.abs(CI[axis]) >= 1.01 then return false end
		end
		return true
	}
]
}
\appendsolid[
	ustart = -1,
	ustop = 1,
	usamples = 2,
	vstart = -1,
	vstop = 1,
	vsamples = 2,
	wstart = -1,
	wstop = 1,
	wsamples = 2,
	transformation = {return T},
	v = {return Vector:new{u, v, w, 1}},
	fill options = {
		preaction = {
			fill = gray,
			fill opacity = 0.5
		},
		postaction = {
			draw = black,
			ultra thin,
			line join = round,
			line cap = round
		}
	}
]
\displaysimplices
\end{tikzpicture}

\caption{Four clipped planes rotate through a translucent cube, with the
inverse transform used as a geometric filter to keep only the portions that
pass through the shared box.}
\end{figure}

\begin{figure}[tbp]
\centering
\begin{tikzpicture}[scale=0.92, line join=round, line cap=round]
\useasboundingbox (-4.5,-4.5) rectangle (4.5,4.5);
\setobject[
	name = view,
	object = {
		return Matrix.zyzrotation3(math.pi/2, math.pi/3, 3.75*math.pi/6 + tau/24)
	}
]
\setobject[
	name = viewinverse,
	object = {return view:inverse()}
]
\appendlight[
	v = {return Vector:new{1, 1, 1, 1}}
]
\foreach \k [evaluate=\k as \myangle using \k*2*pi/6] in {0,1,...,5} {
\appendsurface[
	ustart = -1.5,
	ustop = 1.5,
	usamples = 2,
	vstart = 0,
	vstop = tau,
	vsamples = 30,
	v = {
		local s = Vector.sphere(Vector:new{\myangle + math.pi/2, v, 0.5})
		return Vector:new{
			(u + 3)*math.cos(\myangle) + s[1],
			(u + 3)*math.sin(\myangle) + s[2],
			s[3],
			1
		}
	},
	transformation = {return view},
	fill options = {
		preaction = {
			fill opacity = 1,
			fill = ltdtbrightness
		},
		postaction = {
			draw,
			line width = 0.2pt,
			line join = round,
			line cap = round
		}
	},
	filter = {return false}
]
}
\appendsurface[
	ustart = 0,
	ustop = tau,
	usamples = 20,
	vstart = 0,
	vstop = tau,
	vsamples = 14,
	v = {
		local s = Vector.sphere(Vector:new{u, v, 1})
		return Vector:new{
			3*math.cos(u) + s[1],
			3*math.sin(u) + s[2],
			s[3],
			1
		}
	},
	transformation = {return view},
	fill options = {
		preaction = {
			fill opacity = 1,
			fill = ltdtbrightness
		},
		postaction = {
			draw,
			line width = 0.2pt,
			line join = round,
			line cap = round
		}
	},
	filter = {
		local center = A:hadd(B):hadd(C):hscale(1/3):multiply(viewinverse)
		for spoke = 0, 5 do
			local angle = spoke*math.pi/3
			if center:hdistance(Vector:new{4*math.cos(angle), 4*math.sin(angle), 0, 1}) <= 0.499 then
				return false
			end
			if center:hdistance(Vector:new{2*math.cos(angle), 2*math.sin(angle), 0, 1}) <= 0.499 then
				return false
			end
		end
		return true
	}
]
\displaysimplices
\end{tikzpicture}

\caption{A torus threads through six hidden sleeves, with a single sampled view
from a larger orbital animation revealing the ring of circular exclusions.}
\end{figure}

\begin{figure}[tbp]
\centering
\begin{tikzpicture}[scale=0.94, line join=round, line cap=round]
\setobject[
	name = view,
	object = {
		return Matrix.zyzrotation3(math.pi/2, math.pi/2 + 0.1, 3.75*math.pi/6)
	}
]
\setobject[
	name = viewinverse,
	object = {return view:inverse()}
]
\setobject[
	name = torusinverse,
	object = {
		return function(point)
			local x, y, z = point[1], point[2], point[3]
			local u = math.atan2(y, x)
			if u < 0 then
				u = u + tau
			end
			local radial = math.sqrt(x^2 + y^2)
			local w = math.atan2(radial - 3, z)
			if w < 0 then
				w = w + tau
			end
			return Vector:new{u, w, 0, 1}
		end
	}
]
\appendlight[
	v = {return Vector:new{1, 1, 1, 1}}
]
\appendsurface[
	ustart = 0,
	ustop = tau,
	usamples = 20,
	vstart = -1,
	vstop = 0.5,
	vsamples = 4,
	v = {
		local c = math.cos(u)/2 + 2
		local s = Vector.sphere(Vector:new{c, math.sin(u)/2 + 2, 1 + v})
		return Vector:new{
			3*math.cos(c) + s[1],
			3*math.sin(c) + s[2],
			s[3],
			1
		}
	},
	transformation = {return view},
	filter = {return false},
	fill options = {
		preaction = {
			fill opacity = 1,
			fill = gray
		},
		postaction = {
			draw = red,
			line width = 0.2pt,
			line join = round,
			line cap = round
		}
	}
]
\appendsurface[
	ustart = 0,
	ustop = tau,
	usamples = 20,
	vstart = 0,
	vstop = tau,
	vsamples = 14,
	v = {
		local s = Vector.sphere(Vector:new{u, v, 1})
		return Vector:new{
			3*math.cos(u) + s[1],
			3*math.sin(u) + s[2],
			s[3],
			1
		}
	},
	transformation = {return view},
	fill options = {
		preaction = {
			fill opacity = 1,
			fill = ltdtbrightness
		},
		postaction = {
			draw,
			line width = 0.2pt,
			line join = round,
			line cap = round
		}
	},
	filter = {
		return torusinverse(
			A:hadd(B):hadd(C):hscale(1/3):multiply(viewinverse)
		):hdistance(Vector:new{2, 2, 0, 1}) > 0.499
	}
]
\displaysimplices
\end{tikzpicture}

\caption{A torus is cut by a gray traced surface, while the visible mesh keeps
only the region whose inverse-parameter image stays outside a circular hole in
torus coordinates.}
\end{figure}

\begin{figure}[tbp]
\centering
\begin{tikzpicture}[line join=round, line cap=round]
\useasboundingbox (-4.8,-4.6) rectangle (4.8,4.8);
\appendlight[
	v = {return Vector:new{1, 1, 1, 1}}
]
\setobject[
	name = fieldview,
	object = {
		return Matrix.zyzrotation3(math.pi/3, math.pi/3, math.pi/3)
			:multiply(Matrix.perspective(Vector:new{0, 0, -0.12, 1}))
	}
]
\foreach \ix [evaluate=\ix as \x using 4*\ix/3] in {-3,-2,...,3} {
\foreach \iy [evaluate=\iy as \y using 4*\iy/3] in {-3,-2,...,3} {
\foreach \iz [evaluate=\iz as \z using 4*\iz/3] in {-3,-2,...,3} {
\appendcurve[
	uparams = {return Vector:new{0, 1, 2}},
	v = {
		local px, py, pz = \x - 2, \y, \z
		local qx, qy, qz = \x + 2, \y, \z
		local pl = math.sqrt(px^2 + py^2 + pz^2)
		local ql = math.sqrt(qx^2 + qy^2 + qz^2)
		local fx = px/pl^3 - qx/ql^3
		local fy = py/pl^3 - qy/ql^3
		local fz = pz/pl^3 - qz/ql^3
		local fl = math.sqrt(fx^2 + fy^2 + fz^2)
		local scale = 0.42/fl
		return Vector:new{\x + u*scale*fx, \y + u*scale*fy, \z + u*scale*fz, 1}
	},
	transformation = {return fieldview},
	draw options = {draw=black!70, line width=0.28pt},
	arrow tip = {fill=black!70, draw=none}
]
}
}
}
\foreach \focusx/\focusfill in {-2/blue!70!black,2/red!75!black} {
\appendsurface[
	uparams = {return Vector:new{0, tau, 7}},
	vparams = {return Vector:new{0, math.pi, 7}},
	v = {
		local s = Vector.sphere(Vector:new{u, v, 0.24})
		return Vector:new{\focusx + s[1], s[2], s[3], 1}
	},
	transformation = {return fieldview},
	fill options = {
		fill = {\focusfill!50!ltdtbrightness}
	}
]
}
\displaysimplices
\end{tikzpicture}

\caption{A dipole-like field adapted into three dimensions, with short arrows
sampled on a cubic lattice and two small spheres marking the focal sources at
$(-2,0,0)$ and $(2,0,0)$.}
\end{figure}

\begin{figure}[p]
\centering
\foreach \FRAME/\PHASELABEL [count=\PanelIndex from 1] in {0/0.0,0.9/0.9,1.8/1.8,2.7/2.7,3.6/3.6,4.5/4.5} {%
\begin{minipage}[t]{0.48\linewidth}
\centering
\begin{tikzpicture}[scale=0.50, line join=round, line cap=round]
\useasboundingbox (-6,-6) rectangle (6,6);
\pgfmathsetmacro{\SSS}{3}
\pgfmathsetmacro{\PHASE}{pi*\FRAME/9}
\appendlight[v = {return Vector:new{1, 1, 2, 1}}]
\setobject[
	name = rot,
	object = {return \PHASE}
]
\setobject[
	name = view,
	object = {return Matrix.zyzrotation3(math.pi/2, math.pi/3, math.pi/6)}
]
\setobject[
	name = clifford,
	object = {
		return function(u, v)
			local scale = 1/math.sqrt(2)
			local x1 = scale*math.cos(u)
			local y1 = scale*math.sin(u)
			local x2 = scale*math.cos(v)
			local y2 = scale*math.sin(v)
			local xr = x1*math.cos(rot) - y2*math.sin(rot)
			local wr = x1*math.sin(rot) + y2*math.cos(rot)
			local yr = y1
			local zr = x2
			local denom = 1 - wr
			if denom < 0.0001 then
				return nil
			end
			local px = xr/denom
			local py = yr/denom
			local pz = zr/denom
			if px*px + py*py + pz*pz > 1000 then
				return nil
			end
			return Vector:new{px, py, pz, 1}
		end
	}
]
\appendsurface[
	uparams = {return Vector:new{0, tau, 20}},
	vparams = {return Vector:new{0, tau, 15}},
	transformation = {return view},
	v = {
		local point = clifford(u, v)
		if not point then
			return nil
		end
		return Vector:new{point[1], point[2], point[3], 1}
	},
	filter = {
		local M = A:hadd(B):hadd(C):hscale(1/3):multiply(view:inverse())
		return math.abs(M[1]) < \SSS + 0.001 and math.abs(M[2]) < \SSS + 0.001 and math.abs(M[3]) < \SSS + 0.001
	},
	fill options = {fill={cyan!35!ltdtbrightness}, draw={cyan!20!black}, line width=0.08pt}
]
\appendsolid[
	uparams = {return Vector:new{-\SSS, \SSS, \SSS}},
	vparams = {return Vector:new{-\SSS, \SSS, \SSS}},
	wparams = {return Vector:new{-\SSS, \SSS, \SSS}},
	transformation = {return view},
	filter = {return false},
	v = {return Vector:new{u, v, w, 1}}
]
\displaysimplices
\end{tikzpicture}

\small Frame \PHASELABEL
\end{minipage}%
\ifodd\PanelIndex
\hfill
\else
\par\medskip
\fi
}
\caption{Six selected frames from a Clifford-surface sequence, arranged in
reading order as a two-column page figure. Each panel keeps the same clipped
view box while the phase parameter advances through the chosen samples.}
\end{figure}
