intersectsPoint static method
Test the point q to see whether it intersects the Envelope defined by p1-p2
@param p1 one extremal point of the envelope
@param p2 another extremal point of the envelope
@param q the point to test for intersection
@return true
if q intersects the envelope p1-p2
Implementation
static bool intersectsPoint(Coordinate p1, Coordinate p2, Coordinate q) {
//OptimizeIt shows that Math#min and Math#max here are a bottleneck.
//Replace with direct comparisons. [Jon Aquino]
if (((q.x >= (p1.x < p2.x ? p1.x : p2.x)) &&
(q.x <= (p1.x > p2.x ? p1.x : p2.x))) &&
((q.y >= (p1.y < p2.y ? p1.y : p2.y)) &&
(q.y <= (p1.y > p2.y ? p1.y : p2.y)))) {
return true;
}
return false;
}