AATriangle Class Reference

An axis-aligned triangle (ie. More...

#include <aatriangle.hpp>

List of all members.

Public Types

enum  Direction {
  SOUTHWEST = 0, NORTHEAST, SOUTHEAST, NORTHWEST,
  DIRECTION_MASK = 0x0003, DEFORM_BOTTOM = 0x0010, DEFORM_TOP = 0x0020, DEFORM_LEFT = 0x0030,
  DEFORM_RIGHT = 0x0040, DEFORM_MASK = 0x0070
}
 Directions:. More...

Public Member Functions

 AATriangle ()
 AATriangle (const Rectf &newbbox, int newdir)

Static Public Member Functions

static int vertical_flip (int dir)

Public Attributes

Rectf bbox
int dir


Detailed Description

An axis-aligned triangle (ie.

a triangle where 2 sides are parallel to the x- and y-axis.

Definition at line 26 of file aatriangle.hpp.


Member Enumeration Documentation

enum AATriangle::Direction

Directions:.

SOUTHEWEST NORTHEAST SOUTHEAST NORTHWEST * or *---* or * or *---* | \ \ | / | | / | \ \ | / | | / *---* * *---* *

Deform flags: (see docs/aatriangletypes.png for details)

Enumerator:
SOUTHWEST 
NORTHEAST 
SOUTHEAST 
NORTHWEST 
DIRECTION_MASK 
DEFORM_BOTTOM 
DEFORM_TOP 
DEFORM_LEFT 
DEFORM_RIGHT 
DEFORM_MASK 

Definition at line 39 of file aatriangle.hpp.

00039                  {
00040     SOUTHWEST = 0,
00041     NORTHEAST,
00042     SOUTHEAST,
00043     NORTHWEST,
00044     DIRECTION_MASK = 0x0003,
00045     DEFORM_BOTTOM = 0x0010,
00046     DEFORM_TOP = 0x0020,
00047     DEFORM_LEFT = 0x0030,
00048     DEFORM_RIGHT = 0x0040,
00049     DEFORM_MASK = 0x0070
00050   };


Constructor & Destructor Documentation

AATriangle::AATriangle (  )  [inline]

Definition at line 55 of file aatriangle.hpp.

00055                :
00056     bbox(),
00057     dir(SOUTHWEST)
00058   {
00059   }
  AATriangle(const Rectf& newbbox, int newdir) :

AATriangle::AATriangle ( const Rectf newbbox,
int  newdir 
) [inline]

Definition at line 60 of file aatriangle.hpp.

00060                                                :
00061     bbox(newbbox),
00062     dir(newdir)
00063   {
00064   }


Member Function Documentation

int AATriangle::vertical_flip ( int  dir  )  [static]

Definition at line 22 of file aatriangle.cpp.

References DEFORM_BOTTOM, DEFORM_MASK, DEFORM_TOP, and DIRECTION_MASK.

Referenced by Sector::collision_tilemap().

00022                                      {
00023   int direction = dir & AATriangle::DIRECTION_MASK;
00024   direction = 3 - direction;
00025   int deform = dir & AATriangle::DEFORM_MASK;
00026   switch (deform) {
00027     case AATriangle::DEFORM_BOTTOM:
00028       deform = AATriangle::DEFORM_TOP;
00029       break;
00030     case AATriangle::DEFORM_TOP:
00031       deform = AATriangle::DEFORM_BOTTOM;
00032       break;
00033     default:
00034       // unchanged
00035       break;
00036   }
00037   return (direction | deform);
00038 }


Member Data Documentation

Rectf AATriangle::bbox

Definition at line 67 of file aatriangle.hpp.

int AATriangle::dir

Definition at line 68 of file aatriangle.hpp.


The documentation for this class was generated from the following files:
Generated on Mon Jun 9 03:38:28 2014 for SuperTux by  doxygen 1.5.1