ObjectARX自定义实体的最近点和垂点捕捉算法

2018-06-17 22:40:07来源:未知 阅读 ()

新老客户大回馈,云服务器低至5折

 最近点用pickPoint来计算,垂点用lastPoint计算.

一般AcDbCurve类可以用AcGe类的 getClosestPointTo 来实现计算需要的点值.

下面是代码示例: 

case AcDb::kOsModeNear:

       {

           AcGeLine3d line3d(m_ptA,m_ptC);         

           AcGePointOnCurve3d tmpPt;

           line3d.getClosestPointTo(pickPoint,tmpPt);

           AcGePoint3d pt=tmpPt.point();

          

           snapPoints.append(AcGePoint3d(pt));

           line3d.set(m_ptB,m_ptD);

           line3d.getClosestPointTo(pickPoint,tmpPt);

           pt=tmpPt.point();

           snapPoints.append(AcGePoint3d(pt));

       }

       break;

    case AcDb::kOsModePerp:

       {

           AcGeLine3d line3d(m_ptA,m_ptC);         

           AcGePointOnCurve3d tmpPt;

           line3d.getClosestPointTo(lastPoint,tmpPt);

           AcGePoint3d pt=tmpPt.point();

 

           snapPoints.append(AcGePoint3d(pt));

           line3d.set(m_ptB,m_ptD);

           line3d.getClosestPointTo(lastPoint,tmpPt);

           pt=tmpPt.point();

           snapPoints.append(AcGePoint3d(pt));

       }

       break;

 

标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇:T4310 祖玛游戏

下一篇:Problem A: 数量的类模板 求助注释处引用为什么不能用