within method
Tests whether this geometry is within the specified geometry.
The within
predicate has the following equivalent definitions:
- Every point of this geometry is a point of the other geometry, and the interiors of the two geometries have at least one point in common.
- The DE-9IM Intersection Matrix for the two geometries matches
[T*F**F***]
g.contains(this) = true
(within
is the converse of {@link #contains})
A.within(B) = false
(As a concrete example, take A to be a LineString which lies in the boundary of a Polygon B.)
For a predicate with similar behaviour but avoiding
this subtle limitation, see {@link #coveredBy}.
@param g the Geometry
with which to compare this Geometry
@return true
if this Geometry
is within
g
@see Geometry#contains @see Geometry#coveredBy
Implementation
bool within(Geometry g) {
return g.contains(this);
}