Move point along “recticircle” path

functionsgeometry

Given a "recticircle":
$$\left(\frac{\operatorname{abs}\left(x\right)}{a}\right)^{2a/r}+\left(\frac{\operatorname{abs}\left(y\right)}{b}\right)^{2b/r}=1$$

with $a$ being the width, $b$ being the height and $r$ be the radius of the corners, which gives this kind of shapes:

enter image description here

How do I make a function in which a point follow its path?

For example, to make a point follow a circular path the following function is used:
$$x = \text{Math.sin(time)* rad;}$$
$$y = \text{Math.cos(time) * rad;}$$

in which rad is the radius of the circle, and time is the current point of the simulation.

Best Answer

This parameterization should work: $$ \DeclareMathOperator{\sign}{sign} x=a\,\sign(\cos t)\,|\cos t|^{r/a}, \quad y=b\,\sign(\sin t)\,|\sin t|^{r/b}, $$ where $\sign(\cdot)$ is the sign function.

Related Question