Parameterization of a Torus with `minor > major`
Closed this issue · 8 comments
I stumbled onto this while testing a new surface integral function:
- A
Torus
can be constructed whoseminor
radii is greater than itsmajor
radii. Based on a quick reading of the Wikipedia page (IANA-geometer), it sounds like this is valid but sort of a special case. - For such a
Torus
, the current parameterization code will error. Line 55 essentially takessqrt(t.major^2 - t.minor^2)
, which throws aDomainError
since the argument is negative but also<:Real
.
Meshes.jl/src/primitives/torus.jl
Lines 47 to 63 in d52cc5e
I don’t know enough about how the parameterization here is derived to know whether the absolute value of the interior term could be taken first, or if parameterizing Torus
with this property is a harder problem. It’s also non-obvious to me whether this type of Torus
was even intended to be supported.
@stla could you please take a look in this issue? Do I remember correctly that you added the Torus primitive last year?
Yes, that's me. In fact, I implemented a non-usual parameterization of the torus, valid only for major > minor. I thought it was interesting because it is a conformal parameterization, but actually this is useless.
What do you suggest in this case @stla? Should we adopt a different parametrization?
Yes, we should adopt the classical parameterization (certainly given on Wikipedia).
This seems like it should be easy enough to re-implement. I’ll make an attempt at a PR for this.
Fixed on master.