Reversing the process of taking the “sine of an arbitrary shape”

I'm sure we've all seen images such as the following, from wikipedia: link. They give us some nice intuition on what the sine and cosine functions are. Some people may also have seen images such as this one, or even this one, where instead of a circle, we take the 'sine of an arbitrary shape,' hence the title of this question. I'll say that the shape generates a periodic function in this way.

I now have a couple questions:

1. Given a periodic function, is there always a shape that generates that function as in the second image (with the period adjusted as necessary, of course)?
2. Are such shapes necessarily unique for a given periodic function (provided they exist)?
3. In particular, what are the shapes (if any) that generate triangle, square, and sawtooth waves?

Also, if this is something that has been studied in detail, please enlighten me as to the terminology that people might use in this context.

-
If the boundary curve of the shape has a parametrisation $$p(\varphi) = r(\varphi)\cdot e^{i\varphi},$$ you get the radius $r(\varphi)$ back by dividing the "shape sine" by the ordinary sine. – Daniel Fischer Sep 4 '14 at 23:17

Given a periodic function $f(x)$ with period $2\pi$ and $f(0)=0$, there is polar function $$g(\theta) = f(\theta)/\sin(\theta)$$ that defines the shape. Note that this does not give you the values at $\theta\in\{0,\pi\}$; this is where you have to take a limit. If $f(\pi)\ne 0$ that might be difficult...

Shapes are thus unique, but if you have more than one place where $f(x)=0$, you can shift $f$ horizontally to get a different shape.

I can't do the others in my head, but the square wave is $g(\theta)=\left|\csc{\theta}\right|$, two horizontal lines.

EDIT here's the one for a triangle wave of maximum displacement $\pi/2$. Not exactly sure what function the curves follow.

EDIT 2 The sawtooth one, going from $-\pi/2$ to $\pi/2$, looks just like the triangle wave but it's only the right lobe, which gets drawn twice.

-
You also need $f(\pi) = 0$ or you'll run into trouble at $\theta = \pi$. – Robert Israel Sep 4 '14 at 23:22
Drawn twice how? Care to explain? – Samuel Yusim Sep 5 '14 at 3:37
For $\theta\in(-\pi/2,\pi/2)$, sgn(sawtooth) = sgn(sin); the resulting $g$ gives positive radius, and draws the right half of the triangle wave's lens shape. for $\theta \in (\pi/2, 3\pi/2)$, those signs are opposites; $g$ is negative, so it draw on the right side again, but otherwise it looks the same as the first half; the function once again traces the right half of the lens. THis double trace actually happens for all functions with period $\pi$ when run against plain $\sin(\theta)$ (period $2\pi$). – Dan Uznanski Sep 5 '14 at 11:44

My original answer was mostly wrong, so I am replacing it here with something that is (I think) actually correct.

Suppose you have a periodic functions, $f(t)$, with period $T$. We want to define a path in $\mathbb{R}^2$ such that the "sine" of the path (in the sense of the examples in the OP) is $f(t)$. What do we mean by this? Specifically, we want to arrange things so that as a "radius" vector from $(0,0)$ to the path sweeps around in a circle with uniform speed, the $y$-coordinate of the point on the path to which it points will be equal to $f(t)$.

Let's get more precise, here. We want to parametrize a path $(x(t),y(t)), t \in [0,T]$, so that $y(t)=f(t)$ and so that the angle $\theta=\arctan(y/x)$ varies smoothly from $0$ to $2\pi$ as $t$ runs from $0$ to $T$. In other words, we want $\theta = 2\pi t/T$. We now have two different conditions on $\theta$. Combining them, we have $$\arctan(y/x) = 2 \pi t / T$$ $$y/x = \tan (2 \pi t / T)$$ $$x = y \cot (2 \pi t / T)$$

Therefore, the path we want is given by the parametrization $$(x(t),y(t)) = (f(t) \cot (2 \pi t / T), f(t))$$

Notice that in the special case where $f(t)$ is the "normal" sine function, this formula reduces to $(x(t),y(t)) = (\cos(t) , \sin(t) )$, i.e. the usual parametrization of a unit circle.

It is worth nothing, though, that if the periodic functions you are trying to match have any discontinuities in them (as is the case of the square and sawtooth waves) then the "path" $(x(t),y(t))$ will also likely have a discontinuity in it.

-
It didn't occur to me that the parametric form would be quite so graceful. I like it. – Dan Uznanski Sep 5 '14 at 2:16