#ifndef HEADER_SUPERTUX_MATH_AATRIANGLE_HPP
#define HEADER_SUPERTUX_MATH_AATRIANGLE_HPP
-#include "math/rect.hpp"
+#include "math/vector.hpp"
/**
* An axis-aligned triangle (ie. a triangle where 2 sides are parallel to the x-
* and y-axis.
*/
-class AATriangle : public Rect // FIXME: yuck
+class AATriangle
{
public:
/** Directions:
DEFORM_MASK = 0x0070
};
- AATriangle()
- : dir(SOUTHWEST)
+public:
+ AATriangle() :
+ p1(),
+ p2(),
+ dir(SOUTHWEST)
+ {
+ }
+ AATriangle(const Vector& v1, const Vector& v2, int newdir) :
+ p1(v1),
+ p2(v2),
+ dir(newdir)
{
}
- AATriangle(const Vector& v1, const Vector& v2, int newdir)
- : Rect(v1, v2), dir(newdir)
+
+ float get_width() const
{
+ return p2.x - p1.x;
}
+ float get_height() const
+ {
+ return p2.y - p1.y;
+ }
+
+public:
+ Vector p1;
+ Vector p2;
int dir;
};