Computing tangent and normal for a toroidal helix

36 Views Asked by At

I want to align objects on a toroidal helix using the normal and tangent at any point. I have it rendering using the following parametric equations from this post:

$$x = (R + r\cos{nt})\cos{t}$$ $$y = (R + r\cos{nt})\sin{t}$$ $$z = r\sin{nt}$$

Here's how it looks (with an added circle):

enter image description here

My understanding is that I can compute the tangent as:

$$T= \frac{d\textbf{r}}{dt}$$

$$T_x = -(R + r\cos{(nt)})\sin{t} - r n \sin{(nt)}\cos{t} $$ $$T_y = (R + r\cos{(nt)})\cos{t} - r n \sin{(nt)}\sin{t} $$ $$T_z = rn\cos{(nt)}$$

I am hoping to the compute the normal as:

$$N = \frac{d\hat{T}}{dt}$$

where $\hat{T} = \frac{\vec{T}}{\mid{T}\mid}$.

I am wondering if I am on the right track, and whether it would be possible to derive simpler expressions for $T$ and $N$. I'd appreciate any suggestions to compute the normal and tangent. Thanks!

Update (14 Jun 2023)

I ended up using the symmetric derivative of $T$ (normalized) - numerical approximation - to compute $N$.

$$N = \frac{T(t+\delta t) - T(t+\delta t)}{2\delta t}$$

The output from my WebGPU program is shown below. $T$, $N$, and $T\times N$ are used to align the cubes on the helix.

Cubes aligned on a toroidal helix