- UID
- 10905
- 积分
- 114
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2002-10-9
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
我在使用getSamplePoints发现toParam不起作用,总是到曲线尾部.代码如下:
- [FONT=courier new]
- //子函数,用2点将曲线分为1-3段
- bool BreakPointsByTwoPoint(const AcGePolyline2d& polyline2d,const AcGePoint2d& pnt2d1, const AcGePoint2d& pnt2d2,
- AcGePoint2dArray subPnt2ds[3])
- {
- double param1,param2;
- if(Adesk::kTrue!=polyline2d.isOn(pnt2d1,param1))
- {
- acutPrintf(_T("点1:%f,%f位于线外"),pnt2d1.x,pnt2d1.y);
- return false;
- }
- if(Adesk::kTrue!=polyline2d.isOn(pnt2d2,param2))
- {
- acutPrintf(_T("点2:%f,%f位于线外"),pnt2d2.x,pnt2d2.y);
- return false;
- }
- double sparam=polyline2d.startParam();
- double eparam=polyline2d.endParam();
- if(polyline2d.length(sparam,param1)>polyline2d.length(sparam,param2))
- {
- double dTemp=param1;
- param1=param2;
- param2=dTemp;
- }
- //getSamplePoints
- acutPrintf(_T("\nBV:%f,%f,%f,%f-%f,%f,%f,%f-%f,%f"),pnt2d1.x,pnt2d1.y,param1,polyline2d.length(sparam,param1),
- pnt2d2.x,pnt2d2.y,param2,polyline2d.length(sparam,param2),sparam,eparam);
- AcGeDoubleArray params1,params2,params3;
- polyline2d.getSamplePoints(sparam,params1,0.01,subPnt2ds[0],params1);
- polyline2d.getSamplePoints(param1,params2,0.01,subPnt2ds[1],params2);
- polyline2d.getSamplePoints(param2,eparam,0.01,subPnt2ds[2],params3);
- acutPrintf(_T("\n分段线点个数:%d,%d,%d-%d,%d,%d"),subPnt2ds[0].length(),subPnt2ds[1].length(),subPnt2ds[2].length(),
- params1.length(),params2.length(),params3.length());
- return true;
- }
- [/FONT]
复制代码 |
|