Given a sequence of points that represents a spiral, how can I tell if the sequence runs clockwise or counterclockwise?

303 Views Asked by At

I have a sequence of points $P_0, P_1, ..., P_{n-1}$ that represent a spiral in the XY plane. I do not know whether the sequence is running from "in to out" or "out to in". If I start at $P_0$ and march along the spiral, how can I determine whether I am moving clockwise or counterclockwise?

I have seen questions that have solutions for closed polygons, but I was unable to find an answer for the spiral case.

Thank you.

2

There are 2 best solutions below

0
On

There is a simple answer if certain conditions are given. But first a word about why those conditions are important.

A polygon of $n$ sides is completely described by its $n$ vertices. If you just have a list of those $n$ points in sequence around the polygon then you know exactly what points are on the perimeter of the polygon and which are not.

A spiral is generally a curve that does not go only along straight line segments between points from a finite (or even countable) list. Given a list of $n$ points, you know $n$ points on the spiral. You don't know what points are on the spiral "between" the points you were given.

Consider the spiral described in polar coordinates by the equation $r = e^{\theta/50}.$ If we follow this spiral in a counterclockwise direction, it always gets farther from the origin. If you get a list of points along this spiral for $\theta = 0,\frac14\pi,\frac12\pi,\frac34\pi,\pi,\frac54\pi,\frac32\pi, \frac74\pi,2\pi,$ you won't be able to say for sure that these points come from the spiral described by $r = e^{\theta/50}$ (because you don't know about the points "in between"), but it will look like you are following some kind of spiral that spirals outward while going counterclockwise around the origin.

But suppose instead you are given points from the same spiral for $\theta = 6,12,18,24,30,36.$ Since $6$ is just a little smaller than $2\pi,$ you will end up with a set of points each of which appears to be a little bit clockwise from the one before, so the sequence will appear to spiral outward while going clockwise around the origin.


Following those two examples, a set of conditions that will allow you to declare a list of points to be from a clockwise or counterclockwise spiral is as follows:

  • The points are from a spiral.
  • The spiral is a spiral around the origin.
  • The spiral turns in a consistent direction around the origin.
  • The points are sufficiently closely spaced along the spiral. We can consider two points to be "sufficiently close" if the spiral makes less than half a turn around the origin (measured by the angle from the origin) while going from one point to the other.

There are other sets of conditions that would be sufficient, but I think these conditions are ones we are likely to encounter.

Given these conditions, all you need to do is to look at two points and their directions from the origin. To get from one point to the next, you can go clockwise or counterclockwise around the origin, but if we go one way, the angle from the origin will sweep through a range of angles that cover an angle of magnitude less than $\pi$ ($180$ degrees), while if we go the other way the range of angles will sweep an angle of magnitude more than $\pi$. Choose the direction that sweeps through an angle smaller than $\pi$ and call that the direction of the spiral.

0
On

Unfortunately, it's impossible to tell whether a sequence of points that runs along a spiral must force a clockwise or anticlockwise spiral.

Indeed, consider the intersections two spirals running in different directions, ordered by distance from the origin.

enter image description here

These points can be used to satisfy either spiral, and so you can't tell which spiral was used to select the points.