Find the center of a vector field I'm trying to find the center of a vector field. The vector field is "swirling" around some central point that I want to find. If this were an analytical field with circular symmetry (for example: in this image) then I could just find the perpendicular vector at each point, and they would all intersect at the center.
However (1) it's not circular, it's sort of elliptical-ish, and (2) it's experimentally measured, so there is some noise on each vector. I should mention also that it's measured on a nonuniform grid, not sampled on a uniform grid. 
So I could still find the perpendicular vector at each point, and see where they "sort of" intersect, but it starts to get much more challenging. I thought maybe there are some tricks to achieve this.
What is the best way to find the center of a swirling mass of arrows?
 A: Well...it might not be the "best way", but the problem's pretty ill-defined. So here's an attempt, assuming that the distortion is relatively small:
Pick a point $P$ and two perpendicular unit-vector directions $u$ and $s$. ("u" for "up down" and "s" for "side to side", so that I can use these informal terms in the rest of the description).  
If $P$ were at the center of your field, then the average direction of the vectors above $P$, projected onto the $s$ direction, would be the average of the vectors below $P$, projected onto the $s$ direction, but negated. A similar argument goes for $u$. 
So calling the vectors $v_i$ and their basepoints $P_i$, I'd do this:
Let 
$$
Q_{up} = \frac{1}{n_1}\sum_{\{i : (P_i - P) \cdot u > 0\}} (v_i \cdot s) \\
Q_{down} = -\frac{1}{n_2}\sum_{\{i : (P_i - P) \cdot u < 0\}} (v_i \cdot s) 
$$
where $n_1$ and $n_2$ are the number of items in each summation. Then let 
$$
y = Q_{up} + Q_{down}
$$
Using the corresponding formulas
$$
Q_{left} = \frac{1}{n_1}\sum_{\{i : (P_i - P) \cdot s > 0\}} (v_i \cdot u) \\
Q_{right} = -\frac{1}{n_2}\sum_{\{i : (P_i - P) \cdot s < 0\}} (v_i \cdot u) \\
x = Q_{right} + Q_{left}$$
you end up with $x$ and $y$. Add (a small constant times) the vector $(x, y)$ to $P$ to get a new location for $P$. Repeat until $P$ stops moving. 
Tuning the small constant will require a little testing, but basically this is just "gradient descent" on the function "how much does it seem like I'm in the middle of the field?" 
