On Wednesday 03 October 2007 09:34, tomasvdw@[EMAIL PROTECTED]
wrote:
> I have a rectangular area with a set of points at random locations. I
> want a user to be able to browse through the points using the four
> arrow-keys. Given a selected point, which point should be selected if
> the user presses a key?
>
> Currently I select the nearest point from the set of points that make
> an angle of at most 45 degrees with the key-direction, from the
> previous selected point. This resulting browse experience is not to
> intuitive.
Try finding the point that the least using
(1+2*sin(theta))*d
where theta is the angle to the point and d is distance. Points that
are straight in the direction you press are favored: theta=0, so
sin(theta)=0, 1+2*sin(theta) = 1, so the weighted distance to the point
is just d. Points that are at an angle are penalized: say theta=30
degrees, so sin(theta)=.5, 1+2*sin(theta) = 2, so the weighted
distance is 2d.
You can play around with this formula to improve its "feel". Here are
some parameters,
(1+a*sin(theta))*d
(increase a to increase the penalty for being "off center")
(1+sin(theta)^c)*d
a little off center doesn't have much effect, but it builds fast way
off center. You could take square root to reverse the effect.
You will probably combine parameters like this:
(1+a*sin(b*theta)^c)*d
You could try variations of 1/cos(theta) or 1-cos(theta) instead of
sin(theta).
Trying points one after another is going to be boring. You might want
to plot contours of equal "weighted distance". Like a weather map,
plot the weighted distance at each point with redder colors being
farther away (weighted) and greener colors being closer. Then you can
look at the whole map and adjust your parameters.
If computation is an issue, I suggest getting the map function right
first (like the sine function), then approximate it.
Good luck,
-paul-


|