# Supertoroid

class Supertoroid : public feasst::Shape

As currently implemented, the is_inside function does not take into account the diameter of the particle. So different size particles will experience difference sized cavities if using ModelHardShape. Put another way, only the center position is considered.

A supertoroid is given by the following surface vector

$$\left\{ \begin{array}{lr} a_1[a_4+\cos(\eta)^\epsilon_1]\cos(\omega)^\epsilon_2 & -\pi \le \eta \le \pi \\ a_2[a_4+\cos(\eta)^\epsilon_1]\sin(\omega)^\epsilon_2 & -\pi \le \omega \le \pi \\ a_3\sin(\eta)^\epsilon_1 & \end{array} \right\}$$

with an implicit function, $$F$$, where $$F=1$$ at the surface, $$F<1$$ inside, and $$F>1$$ outside,

$$\left(\left(\left(\frac{x}{a_1}\right)^{\frac{2}{\epsilon_2}} + \left(\frac{y}{a_2}\right)^{\frac{2}{\epsilon_2}}\right)^{\frac{\epsilon_2}{2}}-a_4\right)^{\frac{2}{\epsilon_1}}+\left(\frac{z}{a_3}\right)^{\frac{2}{\epsilon_1}}$$.

The size of the hole is related to $$a_4$$, where the radius of the toroid, $$R=a_4\sqrt{a_1^2+a_2^2}$$.

To model a superquadric, set $$a_4=0$$.

Public Functions

double nearest_distance(const Position &point) const

Return the distance from the point to the nearest point on the surface. The distance is negative if the point is inside of the shape and positive if it is outside.

bool is_inside(const Position &point) const

Return true if the point is inside of the shape.

bool is_inside(const Position &point, const double diameter) const

Return true if the sphere of given center point and diameter is entirely inside of the shape.

double surface_area() const

Return the surface area (if implemented).

double volume() const

Return the volume (if implemented).

Arguments

• center: set the unique key for the center positions. Thus, arguments of “key[i]” are expected to follow. The “[i]” is to be substituted for integer dimensions 0, 1, 2, … The “[i]” are also expected to be in order, starting from 0. If center arg is not used, a three dimensional origin is assumed.

• a1: (default: 1).

• a2: (default: 1).

• a3: (default: 1).

• a4: (default: 0).

• epsilon1: (default: 1).

• epsilon2: (default: 1).