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

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

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

下面是代码示例:

case AcDb::kOsModeNear:

{

           AcGeLine3dline3d(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;

上一篇:JspWriter与PrintWriter的关系


下一篇:Unable to find vcvarsall.bat的解决办法