How do I find if a line intersects a closed line (polygon)?

889
4
01-24-2014 05:04 AM
Andreas_W_Paulsen
New Contributor III
I have one closed Polyline: "rectangle" and an open Polyline: "line".
Both Polylines may be Z aware.
What is the best way to find if the "line" intersects the "rectangle" in the XY plane?
That is I want a 2D (XY) test for intersection. I do not need the actual coordinates of any intersection(s).
0 Kudos
4 Replies
LeoDonahue
Occasional Contributor III
ITopologicalOperator
0 Kudos
Andreas_W_Paulsen
New Contributor III
ITopologicalOperator

Call the Intersect method with esriGeometry0Dimension?
Does this take care of the 2D part of the intersection or do I have to strip away any z information first by copying the x and y value of the points?
0 Kudos
LeoDonahue
Occasional Contributor III
From the docs:
If the Geometry includes z or m values, the z or m domains, z or m resolutions,  and z or m cluster tolerance properties must also be defined. The cluster  tolerance and resolutions can be quickly and easily set using SetDefault methods  on ISpatialReferenceResolution and ISpatialReferenceTolerance interfaces.
0 Kudos
WeifengHe
Esri Contributor
If you do not need the actual coordinates of any intersection(s) as you said, you can also use IRelationalOperator methods to test the spatial relation between geometries.
0 Kudos