@Override
protected boolean within(Geometry g1, Geometry g2) {
if (im.get(Inner, Inner) == EmptyDim)
return false;
Polygon a1 = (Polygon) g1;
Polygon a2 = (Polygon) g2;
ComputeIm r2r = new LinearRing_LinearRing(a1.getShell(), a2
.getShell());
IntersectionMatrix tim = r2r.getIM();
if (tim.get(Inner, Outer) != EmptyDim)
return false;
for (Ring r2 : a2.getHoles()) {
ComputeIm r2r2 = new LinearRing_LinearRing(a1.getShell(), r2);
IntersectionMatrix tim2 = r2r2.getIM();
if (tim2.get(Inner, Inner) != EmptyDim)
if (inHoles(r2, a1))
return false;