ArcEngine开发判断3D模型之间的关系

ArcEngine开发判断3D模型之间的关系

 

1、可以通过IRelationalOperator3D接口的Disjoint3D方法查看两个模型是否有相交的地方,C#示例代码如下

public  static  void  TestIntersection()

{

        IGeometry  polylineGeometry = GetPolylineGeometry();
        IGeometry  polygonGeometry = GetPolygonGeometry();

        IRelationalOperator3D  relationalOperator3D = polylineGeometryasIRelationalOperator3D;
        bool intersect = !(relationalOperator3D.Disjoint3D(polygonGeometry));
        //intersect = true

}

新的IRelationalOperator3D2接口增加了IsNear3D方法,可以判断模型一定距离之内是否有其他的模型;

2、判断两个模型之间的距离可以通过IProximityOperator3D接口实现,C#示例代码返回最近的点

public  static  void  ReturnNearestPoint3D()

{

        IGeometry  pointGeometry = GetPointGeometry();
        IGeometry  envelopeGeometry = GetEnvelopeGeometry();

        IProximityOperator3D
  proximityOperator3D = envelopeGeometry  as  IProximityOperator3D;
        IPoint  nearestPoint3D
= proximityOperator3D.ReturnNearestPoint3D(pointGeometry as  IPoint, esriSegmentExtension.esriNoExtension);
        //nearestPoint3D = (5.393, -0.583, -6.043)

}

public static void QueryNearestPoint3D()
{

        IGeometry pointGeometry = GetPointGeometry();
        IGeometry envelopeGeometry = GetEnvelopeGeometry();
        IProximityOperator3DÂ proximityOperator3D = envelopeGeometry as IProximityOperator3D;
        IPoint nearestPoint3D = new PointClass();
        proximityOperator3D.QueryNearestPoint3D(pointGeometry as IPoint, esriSegmentExtension.esriNoExtension, nearestPoint3D);
        //nearestPoint3D =Â (5.393, -0.583, -6.043)
}

C#示例返回最近距离

public  static  void  ReturnDistance3D()

{

        IGeometry  pointGeometry = GetPointGeometry();
        IGeometry  envelopeGeometry = GetEnvelopeGeometry();

        IProximityOperator3D
proximityOperator3D = envelopeGeometry as IProximityOperator3D;
        double distance3D = proximityOperator3D.ReturnDistance3D(pointGeometry);
        //distance3D = 13.971

}

3、获取3D模型直接相交或者合并的部分可以通过IEnvelope3D实现;该接口实现的只是相交或合并的最大和最小范围;

C#中相交代码如下

publicstaticvoid TestIntersect3D()

{

        IGeometry envelopeGeometry1 = GetEnvelopeGeometry1();

        IGeometry envelopeGeometry2 = GetEnvelopeGeometry2();

        IEnvelope3D envelope3D = envelopeGeometry1 asIEnvelope3D;

        envelope3D.Intersect3D(envelopeGeometry2 asIEnvelope);

}

C#中合并代码如下

publicstaticvoid TestUnion3D()

{

        IGeometry envelopeGeometry1 = GetEnvelopeGeometry1();

        IGeometry envelopeGeometry2 = GetEnvelopeGeometry2();

        IEnvelope3D envelope3D = envelopeGeometry1 asIEnvelope3D;

        envelope3D.Union3D(envelopeGeometry2 asIEnvelope);

}

 

以上

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值