A class that stores a 2D geometrical boundary.
A point in 2D or 3D with translation and scaling methods.
static const Position INVALID
used to indicate that a position is valid
A simple triangle defined in 3D.
const Boundary & getBoundary() const
get triangle boundary
int orientation(const Position &p, const Position &q, const Position &r) const
bool segmentsIntersect(const Position &p1, const Position &q1, const Position &p2, const Position &q2) const
check if two line segments (p1,q1) and (p2,q2) intersect
Boundary myBoundary
triangle boundary
bool operator!=(const Triangle &other) const
inequality operator
bool isPositionWithin(const Position &pos) const
check if the given position is within this triangle
const PositionVector getShape() const
get shape boundary
bool isBoundaryFullWithin(const Boundary &boundary) const
check if the given position is FULL within this triangle
static const Triangle INVALID
invalid triangle
static bool isEar(const Position &a, const Position &b, const Position &c, const PositionVector &shape)
Check if the triangle (A, B, C) is an ear.
bool lineIntersectsTriangle(const Position &p1, const Position &p2) const
check if a line segment (p1, p2) intersects this triangle
static std::vector< Triangle > triangulate(PositionVector shape)
bool intersectWithShape(const PositionVector &shape) const
check if the given shape is within or intersect with this triangle
Position myB
second triangle position
Triangle()
default constructor
bool onSegment(const Position &p, const Position &q, const Position &r) const
check if point q lies on segment pr
Position myA
first triangle position
bool operator==(const Triangle &other) const
equalityoperators
Position myC
third triangle position
bool lineIntersectCircle(const Position &posA, const Position &posB, const Position ¢er, const double radius) const
function to check if line between posA and posB intersect circle
bool intersectWithCircle(const Position ¢er, const double radius) const
check if the given circle intersect with this triangle
static double crossProduct(const Position &a, const Position &b, const Position &c)
calculate cross product of the given points