direction.h
author Darkvater
Mon, 31 Jul 2006 15:49:12 +0000
branch0.4
changeset 10070 308b88d1851f
parent 10032 fcf09abbde96
permissions -rw-r--r--
(svn r5678) - Prepare 0.4 branch for release. Update readme's, bugs, installers, changelog, etc. to 0.4.8-RC2
10032
fcf09abbde96 (svn r5115) Move helper functions to where they belong
tron
parents:
diff changeset
     1
/* $Id$ */
fcf09abbde96 (svn r5115) Move helper functions to where they belong
tron
parents:
diff changeset
     2
fcf09abbde96 (svn r5115) Move helper functions to where they belong
tron
parents:
diff changeset
     3
#ifndef DIRECTION_H
fcf09abbde96 (svn r5115) Move helper functions to where they belong
tron
parents:
diff changeset
     4
#define DIRECTION_H
fcf09abbde96 (svn r5115) Move helper functions to where they belong
tron
parents:
diff changeset
     5
fcf09abbde96 (svn r5115) Move helper functions to where they belong
tron
parents:
diff changeset
     6
fcf09abbde96 (svn r5115) Move helper functions to where they belong
tron
parents:
diff changeset
     7
/* the 2 axis */
fcf09abbde96 (svn r5115) Move helper functions to where they belong
tron
parents:
diff changeset
     8
typedef enum Axis {
fcf09abbde96 (svn r5115) Move helper functions to where they belong
tron
parents:
diff changeset
     9
	AXIS_X = 0,
fcf09abbde96 (svn r5115) Move helper functions to where they belong
tron
parents:
diff changeset
    10
	AXIS_Y = 1,
fcf09abbde96 (svn r5115) Move helper functions to where they belong
tron
parents:
diff changeset
    11
	AXIS_END
fcf09abbde96 (svn r5115) Move helper functions to where they belong
tron
parents:
diff changeset
    12
} Axis;
fcf09abbde96 (svn r5115) Move helper functions to where they belong
tron
parents:
diff changeset
    13
fcf09abbde96 (svn r5115) Move helper functions to where they belong
tron
parents:
diff changeset
    14
fcf09abbde96 (svn r5115) Move helper functions to where they belong
tron
parents:
diff changeset
    15
static inline Axis DiagDirToAxis(uint d)
fcf09abbde96 (svn r5115) Move helper functions to where they belong
tron
parents:
diff changeset
    16
{
fcf09abbde96 (svn r5115) Move helper functions to where they belong
tron
parents:
diff changeset
    17
	return (Axis)(d & 1);
fcf09abbde96 (svn r5115) Move helper functions to where they belong
tron
parents:
diff changeset
    18
}
fcf09abbde96 (svn r5115) Move helper functions to where they belong
tron
parents:
diff changeset
    19
fcf09abbde96 (svn r5115) Move helper functions to where they belong
tron
parents:
diff changeset
    20
fcf09abbde96 (svn r5115) Move helper functions to where they belong
tron
parents:
diff changeset
    21
/*
fcf09abbde96 (svn r5115) Move helper functions to where they belong
tron
parents:
diff changeset
    22
 * Converts an Axis to a DiagDirection
fcf09abbde96 (svn r5115) Move helper functions to where they belong
tron
parents:
diff changeset
    23
 * Points always in the positive direction, i.e. S[EW]
fcf09abbde96 (svn r5115) Move helper functions to where they belong
tron
parents:
diff changeset
    24
 */
fcf09abbde96 (svn r5115) Move helper functions to where they belong
tron
parents:
diff changeset
    25
static inline uint AxisToDiagDir(Axis a)
fcf09abbde96 (svn r5115) Move helper functions to where they belong
tron
parents:
diff changeset
    26
{
fcf09abbde96 (svn r5115) Move helper functions to where they belong
tron
parents:
diff changeset
    27
	return (uint)(2 - a);
fcf09abbde96 (svn r5115) Move helper functions to where they belong
tron
parents:
diff changeset
    28
}
fcf09abbde96 (svn r5115) Move helper functions to where they belong
tron
parents:
diff changeset
    29
fcf09abbde96 (svn r5115) Move helper functions to where they belong
tron
parents:
diff changeset
    30
#endif