|
int myExtendPolyline(AcDbPolyline* pl,double sOff,double eOff)
{
ASSERT(pl);
if (pl->numVerts() < 2)
{
return 0;
}
if (sOff > 0)
{
AcGePoint3d sPt,sPt2;
pl->getStartPoint(sPt);
pl->getPointAt(1,sPt2);
double td1,td2;
pl->getDistAtPoint(sPt,td1);
pl->getDistAtPoint(sPt2,td2);
double off = td2 - td1;
double sParam = fabs(sOff) / off;
if(pl->extend(-sParam) != Acad::eOk)
{
ASSERT(0);
return 0;
}
}
if (eOff > 0)
{
AcGePoint3d ePt,ePt2;
pl->getEndPoint(ePt);
pl->getPointAt(pl->numVerts() - 2,ePt2);
double td1,td2;
pl->getDistAtPoint(ePt2,td1);
pl->getDistAtPoint(ePt,td2);
double off = td2 - td1;
double eparam = fabs(eOff) / off;
if(pl->extend(eparam) != Acad::eOk)
{
ASSERT(0);
return 0;
}
}
return 1;
} |
|