crosses method

bool crosses(
  1. Geometry g
)

Tests whether this geometry crosses the argument geometry.

The crosses predicate has the following equivalent definitions:

  • The geometries have some but not all interior points in common.
  • The DE-9IM Intersection Matrix for the two geometries matches one of the following patterns:
    • [T*T******] (for P/L, P/A, and L/A situations)
    • [T*****T**] (for L/P, A/P, and A/L situations)
    • [0********] (for L/L situations)
For any other combination of dimensions this predicate returns false.

The SFS defined this predicate only for P/L, P/A, L/L, and L/A situations. In order to make the relation symmetric, JTS extends the definition to apply to L/P, A/P and A/L situations as well.

@param g the Geometry with which to compare this Geometry @return true if the two Geometrys cross.

Implementation

bool crosses(Geometry g) {
  // short-circuit test
  if (!getEnvelopeInternal().intersectsEnvelope(g.getEnvelopeInternal()))
    return false;
  return relate(g).isCrosses(getDimension(), g.getDimension());
}