touches method
Tests whether this geometry touches the argument geometry.
The touches
predicate has the following equivalent definitions:
- The geometries have at least one point in common, but their interiors do not intersect.
- The DE-9IM Intersection Matrix for the two geometries matches
at least one of the following patterns
[FT*******]
[F**T*****]
[F***T****]
false
,
since points have only interiors.
This predicate is symmetric.
@param g the Geometry
with which to compare this Geometry
@return true
if the two Geometry
s touch;
Returns false
if both Geometry
s are points
Implementation
bool touches(Geometry g) {
// short-circuit test
if (!getEnvelopeInternal().intersectsEnvelope(g.getEnvelopeInternal()))
return false;
return relate(g).isTouches(getDimension(), g.getDimension());
}