Re: [AD] new GUI focus selection algorithm

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Eric Botcazou wrote:
- I think that using the Euclidean distance is too costly in terms of ratio benefit/overhead.

But this computation is not going to be done more often than the user presses a key! I think we can (and should) ignore the computation time. (Remember that we have to redraw the objects we move from and to anyway, normally a much more costly operation!)

That said, we can avoid square roots by comparing the _squares_ of the (Euclidean) distances. It will be faster and not change the behavior.

After all, all distances are (mathematically) equivalent

Well, they are all metrics, but that is an abstract algebraic notion not related to the geometric interpretation. So it doesn't mean all metrics feel the same way to the user.

and we don't care if our circles look like squares :-)

If our circles look like squares, then A and B have the same distance to C in this example:

 A B


     C

So moving up from C could equally well move to A or B (or always to A, if it ends one pixel below B).

- You should introduce a compile-time parameter in the distance formula so that we can tweak the relative weight of the two axes.

That could make sense, although it will be tedious to implement because we want to swap the weights when moving horizontally vs vertically.

Sven





Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/