ArcGIS Runtime:如何确定两个 3D 几何之间的关系
ArcGIS Runtime : How to determine the relationship between two 3D geometry
我想判断两个3D几何之间的关系:
- 是否重叠
- 如果重叠,重叠的部分是多少,重叠的体积是多少。
想知道ArcGIS中有没有成熟的方法可以实现这样的功能,具体的数学问题对我来说太难实现了
目前在ArcGIS中找到了相关的class 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为空
这里是参考:
我用错方法了,正确的方法如下:
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);
我想判断两个3D几何之间的关系:
- 是否重叠
- 如果重叠,重叠的部分是多少,重叠的体积是多少。
想知道ArcGIS中有没有成熟的方法可以实现这样的功能,具体的数学问题对我来说太难实现了
目前在ArcGIS中找到了相关的class 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为空
这里是参考:
我用错方法了,正确的方法如下:
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);