MFMv2.0.10
Movable Feast Machine Simulator 2.0.10
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Static Public Member Functions | Static Public Attributes
MFM::Dirs Class Reference

Static Public Member Functions

static const char * GetName (Dir dir)
 
static bool IsCorner (Dir dir)
 
static bool IsFace (Dir dir)
 
static Dir CWDir (Dir dir)
 
static Dir OppositeDir (Dir dir)
 
static Dir CCWDir (Dir dir)
 
static u32 AddDirToMask (u32 mask, Dir dir)
 
static u32 RemoveDirInMask (u32 mask, Dir dir)
 
static bool TestDirInMask (u32 mask, Dir dir)
 
static void FillDir (SPoint &pt, Dir dir)
 
static Dir FromOffset (SPoint &pt)
 
static SPointFlipXAxis (SPoint &pt)
 
static SPointFlipYAxis (SPoint &pt)
 
static SPoint FlipSEPointToCorner (const SPoint &pt, const Dir corner)
 

Static Public Attributes

static const Dir NORTH = 0
 
static const Dir NORTHEAST = 1
 
static const Dir EAST = 2
 
static const Dir SOUTHEAST = 3
 
static const Dir SOUTH = 4
 
static const Dir SOUTHWEST = 5
 
static const Dir WEST = 6
 
static const Dir NORTHWEST = 7
 
static const Dir DIR_COUNT = 8
 

Member Function Documentation

static u32 MFM::Dirs::AddDirToMask ( u32  mask,
Dir  dir 
)
inlinestatic

Adds a Dir to a Dir mask.

Parameters
maskThe mask to add a Dir to.
dirThe Dir to add to mask.
Returns
mask with dir added to it.
static Dir MFM::Dirs::CCWDir ( Dir  dir)
inlinestatic

The next dir counter-clockwise from dir. Note that for all dir, IsCorner(dir)==IsFace(CCWDir(dir)), and dir==CCWDir(CWDir(dir))

static Dir MFM::Dirs::CWDir ( Dir  dir)
inlinestatic

The next dir clockwise from dir. Note that for all dir, IsCorner(dir)==IsFace(CWDir(dir)), and dir==CWDir(CCWDir(dir))

void MFM::Dirs::FillDir ( SPoint pt,
Dir  dir 
)
static

Given a Dir , will fill a SPoint with unit offsets representing the direction of this Dir . For instance:

FillDir(pt, NORTH) // pt == (0, -1)
FillDir(pt, SOUTHEAST) // pt == (1, 1)
Parameters
ptThe SPoint to fill with the offsets of a direction.
dirThe Dir specifying the units to fill pt with.
SPoint MFM::Dirs::FlipSEPointToCorner ( const SPoint pt,
const Dir  corner 
)
static

Flips the axes of a given SPoint about the origin. This behaves as if the given SPoint is a SOUTHEAST SPoint, which will represent the specified corner Dir once the flip has taken place. For instance,

SPoint pt(1, 1); // Or, a SOUTHEAST SPoint
FlipSEPointToCorner(pt, NORTHWEST); // pt is now a NORTHWEST SPoint, or (-1, -1)

This performs only axis flipping, keeping the distance from the origin the same.

Parameters
ptThe SPoint to flip the axes of.
cornerThe corner representing the axes of pt to flip. This must be a corner (e.g. NORTHEAST, SOUTHEAST), else this method FAILs with ILLEGAL_ARGUMENT.
Returns
A new point containing the new coordinates of pt , which is also changed.
static SPoint& MFM::Dirs::FlipXAxis ( SPoint pt)
inlinestatic

Flips the X coordinate of a given SPoint about the origin.

Parameters
ptThe SPoint to flip the X coordinate of .
Returns
A reference to pt .
static SPoint& MFM::Dirs::FlipYAxis ( SPoint pt)
inlinestatic

Flips the Y coordinate of a given SPoint about the origin.

Parameters
ptThe SPoint to flip the Y coordinate of .
Returns
A reference to pt .
u32 MFM::Dirs::FromOffset ( SPoint pt)
static

Translates the coordinates in a SPoint to a Dir . The coordinates in SPoint must be a unit offset (like the ones returned from FillDir ), otherwise this will FAIL with ILLEGAL_ARGUMENT .

Parameters
ptThe SPoint containing a unit offset to translate to a Dir .
Returns
The Dir representing the offset held by pt .
static const char* MFM::Dirs::GetName ( Dir  dir)
inlinestatic

map a dir to a readable string

static bool MFM::Dirs::IsCorner ( Dir  dir)
inlinestatic

true iff dir is a corner direction.

static bool MFM::Dirs::IsFace ( Dir  dir)
inlinestatic

true iff dir is a face direction.

static Dir MFM::Dirs::OppositeDir ( Dir  dir)
inlinestatic

Gets the direction opposite the one specified.

Returns
The direction opposite the one specified.
static u32 MFM::Dirs::RemoveDirInMask ( u32  mask,
Dir  dir 
)
inlinestatic

Removes a Dir from a Dir mask.

Parameters
maskThe Dir mask to remove a Dir from.
dirThe Dir to remove from mask.
Returns
mask with dir removed from it.
static bool MFM::Dirs::TestDirInMask ( u32  mask,
Dir  dir 
)
inlinestatic

Checks a Dir mask to see if a Dir is inside it.

Parameters
maskThe mask to check Dir membership of.
dirThe Dir to check mask for membership of.
Returns
true if dir is inside mask, else false.

The documentation for this class was generated from the following files: