1
$\begingroup$

I made up the measure (and its name) and I wonder if it is officially defined (and named!)? I need a name, because when I call it "Manhattan visibility" nobody will understand me unless I explain how it is measured.

Having two points in 2d space, those points are less distance if the angle is closer to 0, and far distance if the angle is close to 45°. Comparing two cases, if angle is the same, the second factor is radius -- the bigger, the more distant two points are.

And thus, I coined term visibility, because if the axis is the same, the points can "see" each other, if the radius (real distance) between is greater, the harder to "see" each other.

Please note, it is not Manhattan distance measure. Points (0,0) and (1,1) are closer than (0,0) and (0,10000), while with my measure the latter pair is closer than the former.

Update 1 to give some background, maybe this will help. I am writing the program which generates analog clocks (visually). Next I need to compute how 2 clocks are similar to each other. So let's say 12:00 and 24:00 are identical, 12:15 and 13:15 are pretty similar, less, but still similar are 12:15 and 16:15. 12:00 and 18:30 are completely different.

Update 2 (not verified yet)

This is the code I came up with to compute it:

var dx = Math.abs(a.x-b.x);
var dy = Math.abs(a.y-b.y);
var min = Math.min(dx,dy);
var max = Math.max(dx,dy);

if (max==0)  // same point
    return 0;
else
    return min*1.0/max+1-1.0/(1+dx*dx+dy*dy);
$\endgroup$
  • $\begingroup$ I'm not entirely sure I understand your definition - could you illustrate by computing the distance (I'm taking you to mean you are talking about a metric) between $P_1 = (1,1)$ and $P_2 = (2,1)$? $\endgroup$ – Jason Knapp Nov 13 '14 at 16:47
  • $\begingroup$ @JasonKnapp, I am working on equation, and that is why I am also looking for name :-) I defined 3 cases, identity (=0), equality of one of the axis, and the rest (working in progress; I am doing it for computer purpose so I would like to avoid trig functions). Since in your question one the axis is the same, my definition says $$1-1/(1+1^2+0^2)$$ which gives $$1/2$$. But it is also not official :-) $\endgroup$ – greenoldman Nov 13 '14 at 16:59
  • 1
    $\begingroup$ The metric you've written isn't equivalent to the one you've defined - under your written metric it's possible for two (pairs of) points at different angles to be equidistant. Your distance has, effectively, two 'infinite ranges' - one covering angle, and then within angle one covering distance, and there's no order-preserving mapping from $\mathbb{R}\times\mathbb{R}$ to $\mathbb{R}$ of the sort you want. (In other words, there's no way to define a real-valued distance between two points that satisfies the constraints you've set.) $\endgroup$ – Steven Stadnicki Nov 13 '14 at 18:19
  • $\begingroup$ @StevenStadnicki, ah, you are right. Thank you very much. Pity I cannot add more points to you :-). $\endgroup$ – greenoldman Nov 13 '14 at 19:49
  • $\begingroup$ @greenoldman I can fix that... :-) Hang on a bit! $\endgroup$ – Steven Stadnicki Nov 13 '14 at 21:48
2
$\begingroup$

The algorithm provided at the end of the question doesn't actually produce an ordering compatible with the requested order relation; in particular, under that code it's possible for two pairs of points at different angles to be equidistant; consider for instance $\langle0,0\rangle$ and $\langle1,2\rangle$ on one hand (where the computed value is $\frac12+1-\frac16=\frac43$) and $\langle0,0\rangle$ and $\langle2,y\rangle$ (with $y\gt2$ to be determined) on the other. Then the computed value for this second pair of points is $\frac2y+1-\frac1{5+y^2}$ $=\frac{10+2y^2}{5y+y^3}+\frac{5y+y^3}{5y+y^3}-\frac{y}{5y+y^3} = \frac{y^3+2y^2+4y+10}{y^3+5y}$). Then by setting this equal to $\frac43$ we get a cubic equation in $y$, $4y^3+20y = 3y^3+6y^2+12y+30$ or equivalently $y^3-6y^2+8y-30=0$; numerically solving this equation yields $y\approx 5.534$ as a solution.

Worse, there is no real function that satisfies the requested ordering. By computing angles (or equivalently, something like tangents of angles - the $\frac{\mathrm{min}}{\mathrm{max}}$ component of the algorithm essentially computes a tangent) and then computing distances we transform the problem into needing an injective function $f:\mathbb{R}\times\mathbb{R}\mapsto\mathbb{R}$ such that $s\gt t$ implies $f(s, x)\gt f(t,y)$ for all $x,y$, and $f(x,s)\gt f(x,t)$ for all $x$. But this ordering is equivalent to trying to fit $\mathbb{R}$ 'copies of' $\mathbb{R}$ side-by-side, and a little thought should convince you (though it's a bit trickier to prove!) that this can't be done in any sufficiently clean fashion.

| cite | improve this answer | |
$\endgroup$
  • $\begingroup$ Thank you again. I "solved" my problem by knowing the source of the data, so I added weight to the first part (angle). This way I still have mathematically incorrect mapping, but at least working in given scenario. $\endgroup$ – greenoldman Nov 14 '14 at 10:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.