当前位置:   article > 正文

AcDbCurve::extend 延长指定多义线的前后长度

acdbcurve::extend
  1. int myExtendPolyline(AcDbPolyline* pl,double sOff,double eOff)
  2. {
  3. ASSERT(pl);
  4. if (pl->numVerts() < 2)
  5. {
  6. return 0;
  7. }
  8. if (sOff > 0)
  9. {
  10. AcGePoint3d sPt,sPt2;
  11. pl->getStartPoint(sPt);
  12. pl->getPointAt(1,sPt2);
  13. double td1,td2;
  14. pl->getDistAtPoint(sPt,td1);
  15. pl->getDistAtPoint(sPt2,td2);
  16. double off = td2 - td1;
  17. double sParam = fabs(sOff) / off;
  18. if(pl->extend(-sParam) != Acad::eOk)
  19. {
  20. ASSERT(0);
  21. return 0;
  22. }
  23. }
  24. if (eOff > 0)
  25. {
  26. AcGePoint3d ePt,ePt2;
  27. pl->getEndPoint(ePt);
  28. pl->getPointAt(pl->numVerts() - 2,ePt2);
  29. double td1,td2;
  30. pl->getDistAtPoint(ePt2,td1);
  31. pl->getDistAtPoint(ePt,td2);
  32. double off = td2 - td1;
  33. double eparam = fabs(eOff) / off;
  34. if(pl->extend(eparam) != Acad::eOk)
  35. {
  36. ASSERT(0);
  37. return 0;
  38. }
  39. }
  40. return 1;
  41. }

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/繁依Fanyi0/article/detail/114402
推荐阅读
相关标签
  

闽ICP备14008679号