computeProperIntersectionIM method

void computeProperIntersectionIM(
  1. SegmentIntersector intersector,
  2. IntersectionMatrix im
)

Implementation

void computeProperIntersectionIM(
    SegmentIntersector intersector, IntersectionMatrix im) {
  // If a proper intersection is found, we can set a lower bound on the IM.
  int dimA = arg[0].getGeometry()!.getDimension();
  int dimB = arg[1].getGeometry()!.getDimension();
  bool hasProper = intersector.hasProperIntersection();
  bool hasProperInterior = intersector.hasProperInteriorIntersection();

  // For Geometry's of dim 0 there can never be proper intersections.

  /**
   * If edge segments of Areas properly intersect, the areas must properly overlap.
   */
  if (dimA == 2 && dimB == 2) {
    if (hasProper) im.setAtLeastDimensionSymbols("212101212");
  }
  /**
   * If an Line segment properly intersects an edge segment of an Area,
   * it follows that the Interior of the Line intersects the Boundary of the Area.
   * If the intersection is a proper <i>interior</i> intersection, then
   * there is an Interior-Interior intersection too.
   * Note that it does not follow that the Interior of the Line intersects the Exterior
   * of the Area, since there may be another Area component which contains the rest of the Line.
   */
  else if (dimA == 2 && dimB == 1) {
    if (hasProper) im.setAtLeastDimensionSymbols("FFF0FFFF2");
    if (hasProperInterior) im.setAtLeastDimensionSymbols("1FFFFF1FF");
  } else if (dimA == 1 && dimB == 2) {
    if (hasProper) im.setAtLeastDimensionSymbols("F0FFFFFF2");
    if (hasProperInterior) im.setAtLeastDimensionSymbols("1F1FFFFFF");
  }
  /* If edges of LineStrings properly intersect *in an interior point*, all
      we can deduce is that
      the interiors intersect.  (We can NOT deduce that the exteriors intersect,
      since some other segments in the geometries might cover the points in the
      neighbourhood of the intersection.)
      It is important that the point be known to be an interior point of
      both Geometries, since it is possible in a self-intersecting geometry to
      have a proper intersection on one segment that is also a boundary point of another segment.
  */
  else if (dimA == 1 && dimB == 1) {
    if (hasProperInterior) im.setAtLeastDimensionSymbols("0FFFFFFFF");
  }
}