"""Exact computable placements use rational centers and orthonormal two-column frames. The universal theorem in P03 applies to arbitrary real linear isometric embeddings, including normed ambient spaces; this finite matrix API is a realization subclass, not a replacement hypothesis for that theorem. """ struct ExactPlacement center::Vector{Rat} frame::Matrix{Rat} function ExactPlacement(center::AbstractVector{<:Union{Integer,Rational}}, frame::AbstractMatrix{<:Union{Integer,Rational}}) size(frame,1) == length(center) || throw(DimensionMismatch("center/frame")) size(frame,2) == 2 || throw(DimensionMismatch("frame must have two columns")) C=rational.(center);E=rational.(frame) for i in 1:2,j in 1:2 sum(E[k,i]*E[k,j] for k in eachindex(C)) == rational(i==j) || throw(ArgumentError("frame columns must be exactly orthonormal")) end new(C,E) end end function symbolic_heights() phi=variable(:phi); s=variable(:s) [-(phi^2+s),-(1+s),-s,s,1+s,phi^2+s] end function symbolic_marks(a::Poly=variable(:a)) c=variable(:c); hs=symbolic_heights() [ [a*c,a*z] for z in hs ] end function placed_marks(a::Union{Integer,Rational},p::ExactPlacement) points=symbolic_marks(Poly(a)) [[Poly(p.center[i])+p.frame[i,1]*z[1]+p.frame[i,2]*z[2] for i in eachindex(p.center)] for z in points] end """Parametric descriptor of the entire curve, not a sampled polygon. Arc endpoints are rational multiples of pi; segments are affine parameter maps. Zero radius is a termination descriptor. Invoke geometric provenance only at a>0. """ function outline_spec(a::Union{Integer,Rational},p::ExactPlacement) a=rational(a) (radius=a,center=copy(p.center),frame=copy(p.frame), major_angle_pi=(rational(1,1296000),2-rational(1,1296000)), circle_rule="center + frame * [a*cos(t), a*sin(t)]", upper_levels=(variable(:s),variable(:phi)^2+variable(:s)), lower_levels=(-(variable(:phi)^2+variable(:s)),-variable(:s)), segment_rule="center + frame * [a*c, a*z]",marks=placed_marks(a,p)) end function reconstruct_outline(h::Union{Integer,Rational},p::ExactPlacement, terminal::Integer,remainders::AbstractVector{<:Integer}) h=rational(h) h > 0 || throw(DomainError(h,"retained grid scale must be positive")) d=decode_checked(Q,S,terminal,remainders) outline_spec(h*d,p) end """Optional BigFloat illustration of formulas; no approximate value certifies a theorem.""" function numerical_geometry(a::Rational; bits::Int=256) a > 0 || throw(DomainError(a,"positive geometric radius required")) setprecision(BigFloat,bits) do av=BigFloat(a);pv=(1+sqrt(BigFloat(5)))/2;πv=BigFloat(pi) δ=πv/1296000;sv=sin(δ);cv=cos(δ) hs=[-(pv^2+sv),-(1+sv),-sv,sv,1+sv,pv^2+sv] marks=[complex(av*cv,av*z) for z in hs] G=(abs(marks[1]-marks[2])+abs(marks[6]-marks[5]))/2 C=av*(3*πv/2-πv/2) (marks=marks,G=G,C=C,lambda=G/(G+C),phi=pv,pi=πv,s=sv,c=cv,delta=δ) end end