consolidated isInTriangle as JavaScript cannot handle override