isPointInsideTriangle method
Implementation
bool isPointInsideTriangle(Offset vertexA, Offset vertexB, Offset vertexC) {
double alpha = ((vertexB.dy - vertexC.dy) * (dx - vertexC.dx) +
(vertexC.dx - vertexB.dx) * (dy - vertexC.dy)) /
((vertexB.dy - vertexC.dy) * (vertexA.dx - vertexC.dx) +
(vertexC.dx - vertexB.dx) * (vertexA.dy - vertexC.dy));
double beta = ((vertexC.dy - vertexA.dy) * (dx - vertexC.dx) +
(vertexA.dx - vertexC.dx) * (dy - vertexC.dy)) /
((vertexB.dy - vertexC.dy) * (vertexA.dx - vertexC.dx) +
(vertexC.dx - vertexB.dx) * (vertexA.dy - vertexC.dy));
double gamma = 1.0 - alpha - beta;
return alpha > 0 && beta > 0 && gamma > 0;
}