ObjectARX学习笔记(廿九)---判断两条线段是否共线AcGeLineSeg3d ObjectARX学习笔记(廿八)---如何计算两条线段的交点AcGeLineSeg3d

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("\n共线1"));
}
else
{
acutPrintf(_T("\n不共线"));
}
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("\n共线2"));
}
else
{
acutPrintf(_T("\n不共线"));
}

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("\n共线3"));
}
else
{
acutPrintf(_T("\n不共线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);//交点
 

扫描二维码关注公众号,回复: 9516739 查看本文章


 

猜你喜欢

转载自www.cnblogs.com/mjgw/p/12392806.html