I want to judge the relationship between two 3D geometry:
I want to know if there is a mature method in ArcGIS to achieve such a function, because it is too difficult for me to implement specific mathematical problems.
Currently I found a related class GeometryEngine
in ArcGIS, but it seems to be invalid:
var onMapLocation = new MapPoint(0, 0, 0, SpatialReferences.Wgs84);
var num = 1;
List<MapPoint> points = new List<MapPoint>();
points.Add(new MapPoint(onMapLocation.X, onMapLocation.Y + num, onMapLocation.Z + num, onMapLocation.SpatialReference));
points.Add(new MapPoint(onMapLocation.X + num, onMapLocation.Y + num, onMapLocation.Z + num, onMapLocation.SpatialReference));
points.Add(new MapPoint(onMapLocation.X + num, onMapLocation.Y, onMapLocation.Z + num, onMapLocation.SpatialReference));
points.Add(new MapPoint(onMapLocation.X, onMapLocation.Y, onMapLocation.Z + num, onMapLocation.SpatialReference));
Esri.ArcGISRuntime.Geometry.Polygon polygon1 = new Esri.ArcGISRuntime.Geometry.Polygon(points);
var num2 = 2;
points = new List<MapPoint>();
points.Add(new MapPoint(onMapLocation.X, onMapLocation.Y + num2, onMapLocation.Z + num2, onMapLocation.SpatialReference));
points.Add(new MapPoint(onMapLocation.X + num2, onMapLocation.Y + num2, onMapLocation.Z + num2, onMapLocation.SpatialReference));
points.Add(new MapPoint(onMapLocation.X + num2, onMapLocation.Y, onMapLocation.Z + num2, onMapLocation.SpatialReference));
points.Add(new MapPoint(onMapLocation.X, onMapLocation.Y, onMapLocation.Z + num2, onMapLocation.SpatialReference));
Esri.ArcGISRuntime.Geometry.Polygon polygon2 = new Esri.ArcGISRuntime.Geometry.Polygon(points);
var g1 = GeometryEngine.Difference(polygon1, polygon2);
The result g1 is empty.
Here is the reference:
I used the wrong method, the correct method are as follows:
var b = GeometryEngine.Intersects(polygon1, polygon2);
var g3 = GeometryEngine.Intersection(polygon1, polygon2);
var g2 = GeometryEngine.Intersections(polygon1, polygon2);
public static bool Intersects(Geometry geometry1, Geometry geometry2);
public static Geometry? Intersection(Geometry geometry1, Geometry geometry2);
public static IReadOnlyList<Geometry> Intersections(Geometry geometry1, Geometry geometry2);