ArcGIS Runtime:如何确定两个三维几何体之间的关系



我想判断两个3D几何体之间的关系:

  1. 是否重叠
  2. 如果重叠,重叠部分是什么,重叠体积是什么

我想知道ArcGIS中是否有成熟的方法来实现这样的功能,因为它对我来说太难实现特定的数学问题了。

目前我在ArcGIS中发现了一个相关的类GeometryEngine,但它似乎无效:

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);

结果g1为空。

以下是参考资料:

https://developers.arcgis.com/net/latest/wpf/api-reference/html/M_Esri_ArcGISRuntime_Geometry_GeometryEngine_Difference.htm

我使用了错误的方法,正确的方法如下:

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);

相关内容

  • 没有找到相关文章

最新更新