Mathematical formula to generate a curved Chinese-style roof
I want to create a Chinese-style curved roof programmatically, something like in the right part of this picture:
As seen in the picture, the roof appears to have four curved segments, which intersect at the diagonals.
I would appreciate a formula as starting point where I can tweak the parameters.
One (rather rough) starting point is the following surface, based on the Lamé curve:
$$\begin{align*}x&=v|\cos\,u|^p \cos\,u\\y&=v|\sin\,u|^p \sin\,u\\z&=\frac{hv}{c^2}(v-2c)\end{align*}$$
where $p > 1$, $h,c > 0$ are adjustable parameters, $0 \leq u \leq 2\pi$, and $v$ ranges over nonnegative values.
Here's an example, with $p=2$, $c=3$, $h=2$, and $0 \leq v \leq 4$:
I am not sure what you are looking for exactly, but to me this roof really looks like a pyramid to which is added the bottom of a sphere: $$z=H - \max(\lvert x\rvert,\lvert y\rvert) + R - \sqrt{R^2-x^2-y^2},$$ where $H$ is the height of the center of the roof, and $R$ is the radius of this supposed sphere, which you can definitely tweak.
In the above example, I chose $x\in\{-1,1\}$ and $y\in\{-1,1\}$, so of course $R$ should not be smaller than $\sqrt{2}$, but the limit depends on the ranges you choose for $x$ and $y$.