This is a partial answer with probable mistakes that will slowly get updates. I want to give the closed analytic solution. This means the answer will be more math-y than code-y, but at the end of the day it can be put in Mathematica. This is fun art for me.
Note, that there are somewhat separate parts to the question. One is when the point is going around along a polygon's border. The other is over curves. Regardless, each process is completely deterministic. For the first part, it is obviously periodic and when it goes on a line it is also periodic.
CONVEX POLYGON
randPoly = RandomPolygon[{"Convex",RandomInteger[{3,10}]}]
which is constructed by line segments.
Please note that the equation of a line when we plug in the first and second point for slope and the intercept is:
$$y:= (\frac{y_2-y_1}{x_2-x_1})(x-x_1)+y_1, \{x_1,x_2\}$$
and the arc length for a line segment, $ℓ$ to to a value $t$ in-between the bounded domain is:
$$ℓ := \sqrt{(\frac{y_2-y_1}{x_2-x_1})^2+1} \cdot (t-x_1)$$
Part I: Point moves along the boundary of the polygon.
The function is in essence a periodic piecewise function $\overline{\rm y} = f(\sigma)$, $\sigma$ is the arclength and $\overline{\rm y}$ is the value for the current line segment where it then repeats. There are two possible directions, clockwise and counterclockwise. Since we know that the solution is periodic, we can just have a chosen method for the first vertex being the reference starting point then shift the function appropriately to the left or right depending on the distance from the chosen reference point to the de facto point given the chosen direction. We will call this shift $\phi$
The reference point is be the point that is the most right out of the highest vertices. Here is how it is calculated in Mathematica:
referencePoint = Flatten[MaximalBy[MaximalBy[randPoly[[1]],Last],First]]
The name of the vertices then go up by 1 as we go clockwise and go in the reveser order as we go counterclockwise. This is the same conventional as a clock.
Given:
- $a$ as the starting value, which is always 1 for us.
- $p$ as the period length
- $n$ as the position in the sequence,
- Clockwise, $\newcommand{\clockwisePolygon}[1]{\overset{\text{⟳}}{#1}}\clockwisePolygon{P}$
In Mathematica, we can go through the names clockwise of the vertices however many times we like by this code:
clockwiseSequence[startValue_, periodLength_, sequenceLength_] :=
Table[
Mod[startValue + Mod[n - 1, periodLength] - 1, periodLength] + 1,
{n, sequenceLength}]
which is mathematically notated by:
$\newcommand{\clockwiseSequence}[1]{\overset{\text{⟳}}{#1}}\clockwiseSequence{a}_n = (( a + (n - 1) \mod p - 1) \mod{p}) + 1$
which leads to the closed analytic solution:
$\newcommand{\clockwiseSequence}[1]{\overset{\text{⟳}}{#1}}
f(\sigma) =
\begin{cases}
f_{\clockwiseSequence{a}_1}(\sigma) & \text{if } 0 \leq \sigma + \phi< \ell_1 \\
f_{\clockwiseSequence{a}_2}(\sigma - \ell_1) & \text{if } \ell_1 \leq \sigma + \phi < \ell_1 + \ell_2 \\
\vdots & \vdots \\
f_{\clockwiseSequence{a}_p}(\sigma - \sum_{i=1}^{p-1} \ell_i) & \text{if } \sum_{i=1}^{p-1} \ell_i \leq \sigma + \phi < \sum_{i=1}^{p} \ell_i \\
\end{cases}$
- Counterclockwise, $\newcommand{\counterClockwisePolygon}[1]{\overset{\text{⟲}}{#1}}\counterClockwisePolygon{P}$
In Mathematica, we can go through the names counterclockwise of the vertices however many times we like by this code:
counterClockwiseSequence[startValue_, periodLength_, sequenceLength_] :=
Table[
Mod[periodLength - Mod[n, periodLength, 1] + startValue, periodLength] + 1,
{n, sequenceLength}]
which is mathematically notated by:
$\newcommand{\counterClockwiseSequence}[1]{\overset{\text{⟲}}{#1}}\counterClockwiseSequence{a}_n := ( p − ((n − 1)\mod{p}) + a − 1)\mod{p} + 1$
which leads to the closed analytic solution:
$\newcommand{\counterClockwiseSequence}[1]{\overset{\text{⟲}}{#1}}
f(\sigma) =
\begin{cases}
f_{\counterClockwiseSequence{a}_1}(\sigma) & \text{if } 0 \leq \sigma + \phi< \ell_1 \\
f_{\counterClockwiseSequence{a}_2}(\sigma - \ell_1) & \text{if } \ell_1 \leq \sigma + \phi< \ell_1 + \ell_2 \\
\vdots & \vdots \\
f_{\counterClockwiseSequence{a}_p}(\sigma - \sum_{i=1}^{p-1} \ell_i) & \text{if } \sum_{i=1}^{p-1} \ell_i \leq \sigma + \phi < \sum_{i=1}^{p} \ell_i \\
\end{cases}$
Part II: Polynomials
Part III: Other Curves