# derive a parametric equation of a sphere (on the first octant) with a dent in the middle

I was trying to derive the surface equation of a sphere where there is a dent in the middle of the surface. I am drawing on the first octant. I want the dent to be formed by changing the radius.

$$r(x,y) = \frac{1}{2}(\cos(2\pi K x) + \cos(2\pi K y))\quad K = 1 \quad (K = \text{number of dents})$$

and the parametric equation of the surface looks like this: $$\begin{eqnarray} f_x(u,v) &=& r(u,v) \cos(u\frac{\pi}{2}) \cos(v\frac{\pi}{2})\\ f_y(u,v) &=& r(u,v) \cos(u\frac{\pi}{2}) \sin(v\frac{\pi}{2})\\ f_z(u,v) &=& r(u,v) \sin(u\frac{\pi}{2})\\ && \text{where,}\quad 0 \leq u,v \leq 1 \end{eqnarray}$$

If I plot $r(x,y)$ within $0 \leq x,y \leq 1$, I get this:

Now if I draw the parametric equation, I get this:

To make a proper adjustment, I change $r(x,y)$ to this: $$r(x,y) = 5 + (\cos(2\pi K x) + \cos(2\pi K y))\quad K = 1$$

Now, if I draw it again, I get this:

Still, if you look at the top of the z-axis, a fold appears which I do not want. Moreover, the scale of the sphere is changed, the radius has been changed to $[0.0, 7.0]$. But what I need is a unit sphere on the first octant without any fold on the top and the lowest point of the dent appears at $(0.5,0.5,0.5)$ coordinate (instead of $(3.5, 3.5, 2.xx)$-ish). How do I do it properly? Moreover, can I do it without $r()$ being a surface? Please help.

Consider the function $\rho(\phi) = 1-d + d\tanh^2 c\phi$. This has a dent of depth $d$ at $\phi=0$. (There are many other possible functions $\rho(\phi)$. For example, something of the form $\rho(\phi) = (1-d+c^2\phi^2)/(1+c^2\phi^2)$ should also work well.) The parameter $c$ is roughly the inverse angular width of the dent. Consider $${\bf r} = \left(\begin{array}{ccc}x&y&z\end{array}\right)^T = \left(\begin{array}{ccc} \rho(\phi)\cos\theta\sin\phi & \rho(\phi)\sin\theta\sin\phi & \rho(\phi)\cos\phi\end{array}\right)^T.$$ We wish to rotate the dent into the first octant. This can be achieved by multiplying on the left by the matrix $R$, where $$R = R_z(\pi/4)R_x(\arccos1/\sqrt3) = \left( \begin{array}{ccc} \frac{1}{\sqrt{2}} & \frac{1}{\sqrt{6}} & \frac{1}{\sqrt{3}} \\ -\frac{1}{\sqrt{2}} & \frac{1}{\sqrt{6}} & \frac{1}{\sqrt{3}} \\ 0 & -\sqrt{\frac{2}{3}} & \frac{1}{\sqrt{3}} \\ \end{array} \right).$$ A parametric plot for $c=5$ and $d$ varying between $0$ and $1-\sqrt3/2$ gives the following:

• Quick question, but shouldn't it be $\rho(\phi)\times\rho(\theta)$? Apr 18, 2017 at 11:14
• @N.Bach: I appreciate your close reading. I am not sure what you mean by $\rho(\phi)\times\rho(\theta)$. Apr 18, 2017 at 16:08
• From what I understood, you modify the usual parametric equation of the sphere by using a radius function that has a "dent" at a specific location. If we skip the rotation part, $[\rho(\phi)\cos\theta\sin\phi,\ \rho(\phi)\sin\theta\sin\phi,\ \rho(\phi)\cos\phi]^T$ has a smaller radius around $\phi=0$, meaning small radius for every great circles with $\phi$ close to $0$, and $\theta\in\mathbb R$...? Yet your image shows variation of the radius that also depends on $\theta$, so I wondered if you meant a radius equal to $\rho(\phi)\times\rho(\theta)$ instead. Apr 18, 2017 at 17:09
• @N.Bach: The rotation is critical. I put the dent along the $z$-axis first, so there is no $\theta$ dependence. Then I rotate the dented sphere so the dent is in the first octant. Apr 18, 2017 at 20:29

You have not been very precise on what you were exactly looking for, but this should serve as a good basis.

The idea is to use a Gaussian to make the dent. The number of dents in $\theta$ is denoted by $n_\theta$, and $n_\phi$ in $\phi$.

Then, introducing some parameters controlling depth ($d$), "sharpness" ($s$), you can use something like:

$$r(\theta,\phi)=1-d\exp\big(s(\sin(n_\theta \theta)^2+\sin(n_\phi \phi)^2)\big)$$

in the parametrization of the sphere $r(\cos(\theta)\sin(\phi),\sin(\theta)\sin(\phi),\cos(\theta))$.

The following Mathematica code provides an example and can be adapted to produce the following animations. The result is better when $n_\theta$ and $n_\phi$ are close.

d = .2; c = 4.; d = 0.03; s = 1.2; np = 8; nt = 5.;
r[theta_,
phi_] := (1 - d*Exp[-s*(-Sin[np*phi]^2 - Sin[nt*theta]^2)]);
ParametricPlot3D[
r[theta, phi]*{Cos[theta] Sin[phi], Sin[theta] Sin[phi],
Cos[phi]}, {theta, 0, 2 Pi}, {phi, 0, Pi}, Boxed -> False,
Axes -> False, Mesh -> None, PlotPoints -> 25,
PlotLegends -> {"np=" <> ToString[np] <> ", nt=" <> ToString[2 nt]}]


Influence of depth $d$:

I don't have the tools to draw my proposal, but I still think I can (hopefully) give you some pointers.

Try a function $r(u,v)$ that satisfies these constraints:

• $\forall 0\le v\le 1$, $r(0,v) = 1$
• $\forall 0\le u\le 1$, $r(u,0) = 1 = r(u,1)$
• EDIT: my first proposition was "$\min_{u,v} r(u,v) = r(0.5,0.5)$", but I realized after reading @user26872's answer that the minimum should not be at $u=0.5=v$, but at $v=0.5$ and $u=\frac{2\arccos\left(\sqrt{\frac 23}\right)}{\pi}\approx 0.39$. Note that the difference in the arccos argument comes from the difference in parameterization.

The first two constraints enforce that $r(u,v)$ is $1$ on the boundary of octant. The third forces the deepest part of the dent to be on the "diagonal" axis (no clue how this is called in english, but basically the line with cartesian equation $x=y=z$).

Also if you want your dent to look as if a small sphere collided with the unit sphere, you probably need to have a "radial/cylindric symmetry" around your minima. With your $u,v$ parameterization it is kinda difficult to express this symmetry properly though...

Anyway try this? $$r(u,v)=1-D\sin\left(\frac{u}{u_\text{min}}\frac{\pi}{2}\right)\sin\left(v\pi\right)$$ where $D$ should be a constant less than 1. (EDIT $u_\text{min}\approx 0.39$ is the value from earlier.) You have $r(u_\text{min},0.5)=1-D$. The problem with this version is that I think (?) it doesn't have the "radial symmetry".

Now for your question "can this be done without $r\left(\ .\right)$ being a surface"... Well no matter how you do this, your final shape cannot have a constant radius, so it will always make sense to define a function $r$ that will look like a surface. But your definition of the shape doesn't need to define $r$ first, so depending on what you want to do with the parametric equation there may be faster or simpler ways.

EDIT 2
Concerning the "radial symmetry" I mentioned, one possible way to express it would be to guarantee that $$r(u,v) = f\left( \cos\left( u\frac\pi 2\right)\cos\left(v\frac\pi 2\right) +\cos\left( u\frac\pi 2\right)\sin\left(v\frac\pi 2\right) +\sin\left( u\frac\pi 2\right) \right)$$ where $f$ is a function from $\mathbb R$ to $\mathbb R^+$.

Or said in plain words, if $(u_1,v_1)$ and $(u_2,v_2)$ have the same value for that sum of cosine-sine thingy, we must have the same radius values, $r(u_1,v_1)=r(u_2,v_2)$. Actually what the sum thingy express, is that on the unperturbed sphere, parameters $(u_1,v_1)$ and $(u_2,v_2)$ corresponds to points on the same circle (on the sphere) around axis $x=y=z$.

But having perfect radial symmetry plus the previous constraints is not very nice, so you're usually better off having some approximation somewhere, especially if this is for a graphical application.