微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

ArcGIS Runtime:如何确定两个3D几何之间的关系

如何解决ArcGIS Runtime:如何确定两个3D几何之间的关系

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

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

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

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

var onMapLocation = new MapPoint(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,onMapLocation.SpatialReference));
points.Add(new MapPoint(onMapLocation.X,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.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);

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。