ArcGIS Pro 2.7 API Reference Guide
Crosses Method (GeometryEngine)
Example 

ArcGIS.Core.Geometry Namespace > GeometryEngine Class : Crosses Method
The base geometry.
The comparison geometry.
Returns true if geometry1 crosses geometry2.
Syntax
Public Function Crosses( _
   ByVal geometry1 As Geometry, _
   ByVal geometry2 As Geometry _
) As Boolean

Parameters

geometry1
The base geometry.
geometry2
The comparison geometry.

Return Value

True if the geometry1 crosses geometry2.
Exceptions
ExceptionDescription
Either geometry1 or geometry2 or both are null or empty.
The method is not implemented for GeometryBag.
Incompatible spatial references between the input geometries.
Remarks
A polyline crosses another polyline if they share only points in common, at least one of which is not an endpoint. A polyline crosses a polygon if at least one path of the polyline is partly inside the polygon and partly outside.

GeometryEngine Crosses

Example
//
// pt on pt
//

MapPoint pt = MapPointBuilder.CreateMapPoint(1.0, 1.0);
MapPoint pt2 = MapPointBuilder.CreateMapPoint(2.0, 2.0);

bool crosses = GeometryEngine.Instance.Crosses(pt, pt2);         // crosses = false
crosses = GeometryEngine.Instance.Crosses(pt, pt);               // crosses = false

// 
// pt and line
// 

List<MapPoint> list = new List<MapPoint>();
list.Add(MapPointBuilder.CreateMapPoint(1.0, 1.0));
list.Add(MapPointBuilder.CreateMapPoint(3.0, 3.0));
list.Add(MapPointBuilder.CreateMapPoint(5.0, 1.0));

Polyline line1 = PolylineBuilder.CreatePolyline(list);
crosses = GeometryEngine.Instance.Crosses(line1, pt2);           // crosses = false
crosses = GeometryEngine.Instance.Crosses(pt2, line1);           // crosses = false
                                                                 // end pt of line
crosses = GeometryEngine.Instance.Crosses(line1, pt);            // crosses = false

//
// pt and polygon
//
List<MapPoint> polyPts = new List<MapPoint>();
polyPts.Add(MapPointBuilder.CreateMapPoint(3.0, 2.0));
polyPts.Add(MapPointBuilder.CreateMapPoint(3.0, 6.0));
polyPts.Add(MapPointBuilder.CreateMapPoint(6.0, 6.0));
polyPts.Add(MapPointBuilder.CreateMapPoint(6.0, 2.0));

Polygon poly1 = PolygonBuilder.CreatePolygon(polyPts);
crosses = GeometryEngine.Instance.Crosses(poly1, pt);              // crosses = false
crosses = GeometryEngine.Instance.Crosses(pt, poly1);              // crosses = false

// 
// line and line
//
List<MapPoint> list2 = new List<MapPoint>();
list2.Add(MapPointBuilder.CreateMapPoint(1.0, 3.0));
list2.Add(MapPointBuilder.CreateMapPoint(3.0, 1.0));
list2.Add(MapPointBuilder.CreateMapPoint(5.0, 3.0));

Polyline line2 = PolylineBuilder.CreatePolyline(list2);
crosses = GeometryEngine.Instance.Crosses(line1, line2);           // crosses = true

//
// line and polygon
//
crosses = GeometryEngine.Instance.Crosses(poly1, line1);           // crosses = true

//
// polygon and polygon
//
Envelope env = EnvelopeBuilder.CreateEnvelope(MapPointBuilder.CreateMapPoint(1.0, 1.0), MapPointBuilder.CreateMapPoint(4, 4));
Polygon poly2 = PolygonBuilder.CreatePolygon(env);
crosses = GeometryEngine.Instance.Crosses(poly1, poly2);           // crosses = false
Requirements

Target Platforms: Windows 10, Windows 8.1

See Also

Reference

GeometryEngine Class
GeometryEngine Members