Module torus_section

Source
Expand description

Where a plane or sphere cuts a torus, read in the torus’s own parameters (ADR 0076).

A torus is not ruled, but at a fixed tube angle v its points form a circle about the axis, and a plane or sphere meets that circle where

A(v) cos(u) + B(v) sin(u) = C(v),

with A, B, C trigonometric in v. So the section is u as a function of v, in closed form, wherever E = A^2 + B^2 - C^2 >= 0:

cos u = (A C - s B sqrt E) / (A^2 + B^2),
sin u = (B C + s A sqrt E) / (A^2 + B^2),     s = +1 or -1.

AngleGraph2 holds that as a pcurve; TorusSection3 the same curve in space. The angle is returned in (-pi, pi]; a piece is built so it never crosses u = pi, where that range wraps.

Structs§

AngleGraph2
The solution u(t) of a(t) cos u + b(t) sin u = c(t) chosen by branch, as a graph over its second coordinate: the point at t is (u(t), t).
TorusCarrier
A torus, as the curve needs it, in axiolid_surface::Torus’s parameterisation: O + (R + r cos v)(cos u X + sin u Y) + r sin v Z.
TorusSection3
A plane’s or sphere’s section of a torus, in space: the torus point at (graph.angle(t), t).