AcGeLineSeg3d acGeLineSegtmp1(AcGePoint3d(0,0,0),AcGePoint3d(100,0,0));
AcGeLineSeg3d acGeLineSegtmp2(AcGePoint3d(10,0,0),AcGePoint3d(90,0,0));
AcGeTol gGetol;
gGetol.setEqualPoint(0.01);
Adesk::Boolean bRec;
bRec = acGeLineSegtmp1.isColinearTo(acGeLineSegtmp2); //此函数只是判断是否共线
if (bRec)
{
acutPrintf(_T("
共线1"));
}
else
{
acutPrintf(_T("
不共线"));
}
acGeLineSegtmp1.set(AcGePoint3d(0,0,0),AcGePoint3d(100,0,0));
acGeLineSegtmp2.set(AcGePoint3d(0,0,0),AcGePoint3d(100,0,0));
bRec = acGeLineSegtmp1.isColinearTo(acGeLineSegtmp2);
if (bRec)
{
acutPrintf(_T("
共线2"));
}
else
{
acutPrintf(_T("
不共线"));
}
acGeLineSegtmp1.set(AcGePoint3d(0,0,0),AcGePoint3d(100,0,0));
acGeLineSegtmp2.set(AcGePoint3d(0,0,0),AcGePoint3d(101.9,0,0));
bRec = acGeLineSegtmp1.isColinearTo(acGeLineSegtmp2);
if (bRec)
{
acutPrintf(_T("
共线3"));
}
else
{
acutPrintf(_T("
不共线3"));
}
ObjectARX学习笔记(廿八)---如何计算两条线段的交点AcGeLineSeg3d
<pre name="code" class="cpp">AcGeLineSeg3d acGeLineSegtmp1(AcGePoint3d(0,100,0),AcGePoint3d(50,100,0));
AcGeLineSeg3d acGeLineSegtmp2(AcGePoint3d(-50,50,0),AcGePoint3d(-50,120,0));
AcGeTol gGetol;gGetol.setEqualPoint(0.001);//设置精度
AcGePoint3d intPnt;//交点
bool bRec = acGeLineSegtmp1.intersectWith(acGeLineSegtmp2,intPnt,gGetol);//交点