# 3D Equivalent of Clockwise and Counter-Clockwise?

As an example say I have some 2D points which are formed into a polygon:

The order of sequential points may be clockwise or counter-clockwise, but is there a 3-dimensional equivalent (even if there are more than two ways of doing it, as long as there are some finite number of ways of doing it for an infinite set of points and it is intrinsic to the geometry, that is nothing like "order by a vector then loop clockwise or counterclockwise around that vector" which might change with different values for the vector.)

• n 3D there are 8 octants in space.So no such convention. – Narasimham Mar 5 '17 at 21:17

You can define if a line (edge connecting two points) has a counterclockwise (positive) or clockwise (negative) moment with respect to a rotation axis. For the planar equivalent the rotation axis is coming out of the plane.

You do this with the triple product. Let's say the rotation axis is $\vec{z}$ and all points are defined wrt. this axis have position $\vec{r}_i$, then two points i and j forming an edge have direction $\vec{e} = \vec{r}_j - \vec{r}_i$

The edge is CCW to the rotation if

$$\vec{z} \cdot \left( \vec{r}_i \times \vec{e} \right) > 0$$

or

$$\vec{z} \cdot \left( \vec{r}_i \times \vec{r}_j \right) > 0$$

• This was actually a specific case I cited as not being a solution as you can choose the vector arbitrarily and get different results for different vectors. – CoryG Mar 6 '17 at 15:25
• Well that is the best you can do. When you are floating in space there is no "up" direction and similarly when you go to 3D you loose the "out-of-plane" direction which defines CW and CWW sense. – ja72 Mar 6 '17 at 19:25
• There's no solution (or finite set of solutions) by defining "out-of-plane" in a similar manner to the way you can use a quaternion for a 3-space rotation? – CoryG Mar 7 '17 at 5:30
• You can define a plane by least squares from the points (average plane), but its up or down direction is arbitrary. You can set a convention where away from the origin = up but then there will be degenerate cases to deal with. Either way, you have to define the plane normal, or axis of rotation $\vec{z}$ first which is what I showed above. – ja72 Mar 7 '17 at 12:46