Quantcast
Channel: Forums - ArcObjects SDKs
Viewing all articles
Browse latest Browse all 1374

Polygon - line intersection problem

$
0
0
Hello,

I am facing a problem when trying to find intersection points between a donut like polygon and a line using ITopologicalOperator.Intersect method:

Code:

  // The polygon has already been casted to ITopologicalOperator4 outside the method
  private static IPointCollection5 ComputeIntersectionPoints(ITopologicalOperator4 topologialOperator, ILine normalLine) {
            object obj = Type.Missing;

            ISegmentCollection segCollection = new PolylineClass() as ISegmentCollection;
            segCollection.AddSegment((ISegment)normalLine, ref obj, ref obj);
            IGeometry resultingGeometry = segCollection as IGeometry;

            topologialOperator.Simplify();
            var intersectionPoints = topologialOperator.Intersect(resultingGeometry, esriGeometryDimension.esriGeometry0Dimension);
            return intersectionPoints.IsEmpty ? new Point() as IPointCollection5 : (IPointCollection5)intersectionPoints;
  }

I am receiving a successful intersection (intersection point) on the other boundary of the polygon but I do not get a hit on the interior border (the result of topologialOperator.Intersect(...) is always null). I have attached a sketch showing the situation. The line starts within the polygon and crosses either the exterior or interior border.

Does anyone can tell me why I do not get the second intersection point. Any help would be very much appreciated! Thank you very much!
Attached Thumbnails
Click image for larger version

Name:	PolygonPolylineIntersection.jpg‎
Views:	N/A
Size:	18.5 KB
ID:	24959  

Viewing all articles
Browse latest Browse all 1374

Trending Articles