[Freeciv-Dev] Re: directional system: more magic code cleanups
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
On Tue, Sep 18, 2001 at 11:57:06PM -0400, Ross W. Wetmore wrote:
> Attached is a copy of straightest_dir with yet another explanation
> of the algorithm embedded as comments in hopes that repetition will
> eventually penetrate those that still haven't got it :-).
> Note that to choose one of 8 directions, the absolute minimum work
> is 3 binary compares, so there is still room for improvement in the
> attached algorithm.
I agree that the the method can be implemented in three compares. My
documentation of the Amiga custom chip Blitter agrees with this.
x1<x2: possible octanes: 0,1,6,7
x1>x2: possible octanes: 2,3,4,5
x1==x2: possible octanes: all
y1<y2: possible octanes: 0,1,2,3
y1>y2: possible octanes: 4,5,6,7
y1==y2: possible octanes: all
|x2-x1|>|y2-y1|: possible octanes: 0,3,4,7
|x2-x1|<|y2-y1|: possible octanes: 1,2,5,6
|x2-x1|==|y2-y1|: possible octanes: all
Note that the octanes used here have to be rotated by \pi/8 to be used
by freeciv.
IF straightest_dir is implemented in such a fashion I would like to
ask you to implement it such as:
int mask1=0xff,mask2=0xff,mask3=0xff;
...
if(y1<y2)
mask1=0x0f;
else
mask1=0xf0;
...
mask=mask1&mask2&mask3;
return mask_to_dir[mask];
}
Overall is looks like this we are already spending our times at the
wrong places.
Raimar
--
email: rf13@xxxxxxxxxxxxxxxxx
"Life is too short for reboots."
- [Freeciv-Dev] Re: directional system: more magic code cleanups, (continued)
- [Freeciv-Dev] Re: directional system: more magic code cleanups, Raimar Falke, 2001/09/17
- [Freeciv-Dev] Re: directional system: more magic code cleanups, Gregory Berkolaiko, 2001/09/17
- [Freeciv-Dev] Re: directional system: more magic code cleanups, Raimar Falke, 2001/09/17
- [Freeciv-Dev] Re: directional system: more magic code cleanups, Jason Dorje Short, 2001/09/17
- [Freeciv-Dev] Re: directional system: more magic code cleanups, Raimar Falke, 2001/09/17
- [Freeciv-Dev] Re: directional system: more magic code cleanups, Jason Dorje Short, 2001/09/17
- [Freeciv-Dev] Re: directional system: more magic code cleanups, Raimar Falke, 2001/09/18
- [Freeciv-Dev] Re: directional system: more magic code cleanups, Jason Dorje Short, 2001/09/18
- [Freeciv-Dev] Re: directional system: more magic code cleanups, Ross W. Wetmore, 2001/09/18
- [Freeciv-Dev] Re: directional system: more magic code cleanups, Ross W. Wetmore, 2001/09/18
- [Freeciv-Dev] Re: directional system: more magic code cleanups,
Raimar Falke <=
- [Freeciv-Dev] Re: directional system: more magic code cleanups, Raimar Falke, 2001/09/20
- [Freeciv-Dev] Re: directional system: more magic code cleanups, Ross W. Wetmore, 2001/09/20
- [Freeciv-Dev] Re: directional system: more magic code cleanups, Raimar Falke, 2001/09/21
- [Freeciv-Dev] Re: directional system: more magic code cleanups, Ross W. Wetmore, 2001/09/21
- [Freeciv-Dev] Re: directional system: more magic code cleanups, Raimar Falke, 2001/09/23
- [Freeciv-Dev] Re: directional system: more magic code cleanups, Ross W. Wetmore, 2001/09/24
- [Freeciv-Dev] Re: directional system: more magic code cleanups, Raimar Falke, 2001/09/24
- [Freeciv-Dev] Re: directional system: more magic code cleanups, Ross W. Wetmore, 2001/09/25
- [Freeciv-Dev] Re: directional system: more magic code cleanups, Raimar Falke, 2001/09/25
- [Freeciv-Dev] Re: directional system: more magic code cleanups, Gregory Berkolaiko, 2001/09/25
|
|