Make a looping (Bézier?) curve

bezier-curvecirclescurvesgraphing-functions

I want to display the path traced by a point, $p_1$ rotating around another, moving point, $p_2$. The point $p_2$ moves parallel to an axis on a plane, and the distance between the points is fixed. Let's assume a circular rotation for simplicity.

For our first case, let's say $p_2$ is static, or, it moves $0$ units per rotation. Then, the path of $p_1$ is just a circle. The point $p_1$ loops back on itself such that it meets with itself one cycle ago. I'll try to formalize this curve.

We've got a function, $_rf_n(t)$, in $\Bbb R^3$, that takes a one-dimensional input and has a two-dimensional output, with respect to the movement of $p_2$, denoted as $n$, and the distance between $p_1$ and $p_2$, denoted as $r$. The input is $t$, the unit of time that is equal to the time taken for one rotation of $p_1$. The $n$-value is equal to the distance travelled by $p_2$ per unit of time. Now, I'm not interested in the curve made by the function itself; not sure what that would even look like. What I'm interested in is looking at all of the points in the output, as they're the ones that trace the movement of $p_1$.

Let $n = 0$, meaning $p_2$ is static, let $r = 1$, and let the starting position of $p_1$ be $(0,1)$.

$_1f_0(0) = (0,1)$, starting position of $p_1$.

$_1f_0(0.25) = (1,2), \ p_1$ has traced out a quarter of the circle.

$_1f_0(0.5) = (2,1), \ p_1$ is has traced a half-circle.

$_1f_0(0.75) = (1,0), \ p_1$ is three-fourths done with the circle.

$_1f_0(1) = (0,1), \ p_1$ is done with the circle and back at the starting point.

$\vdots$

To generalize this to any $r$, any natural $t$ will give $(0,r)$, any natural $t$ plus a fourth, a half or three-fourths will equal $(r,2r)$, $(2r,r)$, and $(r,0)$ respectively. Not sure, but I think it could be generalized to:

$$\text{Curve traced by} \ \ p_1 \ \ \text{when} \ \ _rf_0(t), = \begin{cases} \displaystyle (4\{t\}r, 4\{t\}r + r) & \displaystyle t \in [n, n + \frac 14], n \in \Bbb N \\[2ex] \displaystyle (4\{t\}r, -4\{t\}r + 3r) & \displaystyle t \in (n + \frac 14, n + \frac 12 ], n \in \Bbb N \\[2ex] \displaystyle (-4\{t\}r + 4r, -4\{t\}r + 3r ) & \displaystyle t \in (n + \frac 12, n + \frac 34 ], n \in \Bbb N \\[2ex] \displaystyle (-4\{t\}r + 4r, 4\{t\}r -3r) & \displaystyle t \in (n + \frac 34, n ), n \in \Bbb N \end{cases}$$

The function itself, $_rf_0(t)$, would look identical, only $\{t\}$ would be replaced with $t$. So, what if $p_2$ is moving, however? What if $n \neq 0$?

Again, not sure, but I think one would generalize this, for any $n$-value, as:

$$\text{Curve traced by} \ \ p_1 \ \ \text{when} \ \ _rf_n(t), = \begin{cases} \displaystyle (4\{t\}r + tn, 4\{t\}r + r) & \displaystyle t \in [x, x + \frac 14], x \in \Bbb N \\[2ex] \displaystyle (4\{t\}r + tn, -4\{t\}r + 3r) & \displaystyle t \in
(x + \frac 14, x + \frac 12 ], x \in \Bbb N \\[2ex] \displaystyle (-4\{t\}r + 4r + tn, -4\{t\}r + 3r ) & \displaystyle t \in (x + \frac 12, x + \frac 34 ], x \in \Bbb N \\[2ex] \displaystyle (-4\{t\}r + 4r + tn, 4\{t\}r -3r) & \displaystyle t \in (x + \frac 34, x ), x \in \Bbb N \end{cases}$$

And if I'm not mistaken, if $n \ge 2r$, then the curve becomes sinusoidal, with no looping. So, here's the problem.

Questions:

  1. Is the math featured correct?
  2. If so, how do I show this? I don't know of any program that can have functions with a one-dimensional input and have a two-dimensional output. I don't even know if this is an accepted idea within math.
  3. If the math isn't correct, how else could I achieve this? Bézier curves?

Best Answer

The basic idea is correct. All parametric curves have a one-dimensional input and an output which is either a 2D or 3D point.

The curve you described is called a helix.

The parametric equation of the helix is simple enough, but you can approximate it with Bezier curves if you want to.

Suppose the point $p_2$ is moving with a velocity $w$, starting at a point $c$ when $t=0$. In other words, the position of $p_2$ at time $t$ is given by $p_2(t) = c + tw$. Let $u$ and $v$ be two unit vectors that are perpendicular to $w$ and to each other. Then the position of $p_1$ at time $t$ is given by $$ p_1(t) = p_2(t) + r\cos(t)u + r\sin(t)v $$ Substituting in the value of $p_2(t)$ gives us $$ p_1(t) = c + r\cos(t)u + r\sin(t)v + tw $$ The curve traced out is a helix. If $w$ is the zero vector ($p_2$ is not moving), then it reduces to a circle.

The curve makes one revolution as $t$ varies between $0$ and $2\pi$, and a second turn as $t$ varies between $2\pi$ and $4\pi$, and to on. If you want to get one revolution for each time period $T$, then the equation has to be adapted slightly: it is

$$ p_1(t) = c + r\cos\left(\frac{2\pi t}{T}\right)u + r\sin\left(\frac{2\pi t}{T}\right)v + tw $$

Related Question