找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 405|回复: 2

[求助]:什么函数可以用一长度等分一条曲线?

[复制链接]
发表于 2004-6-9 11:04:20 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

×
我想用一长度值来等分一条直线或曲线,然后将等分的点存在数组中,不知何汉书可以实现?请高手指点,谢谢!
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!

已领礼包: 13个

财富等级: 恭喜发财

发表于 2004-6-11 03:55:07 | 显示全部楼层

Re: [求助]:什么函数可以用一长度等分一条曲线?

最初由 wang_tianyu 发布
[B]我想用一长度值来等分一条直线或曲线,然后将等分的点存在数组中,不知何汉书可以实现?请高手指点,谢谢! [/B]


AcDbCurve::getSplitCurves(...)


  1. virtual Acad::ErrorStatus

  2. getSplitCurves(

  3. const AcGePoint3dArray& points,

  4. AcDbVoidPtrArray& curveSegments) const;

  5. points Input array of points (in WCS coordinates) on the curve
  6. curveSegments Returns with pointers to newly created entities that are
  7. subcurves of the original
复制代码


你要仅仅得到这些点,而不是实际上把曲线断开,那么先求出曲线上度,然后除以等分数,每段的长度,然后循环下,利用:


  1. AcDbCurve::getPointAtDist Function virtual Acad::ErrorStatus

  2. getPointAtDist(

  3. double unnamed,

  4. AcGePoint3d& unnamed) const;

  5. unnamed Input distance along the curve from the beginning of the curve
  6. to the location of the desired point

  7. unnamed Returns the point located at the location specified by dist


  8. This function determines the point on the curve that is a distance of dist
  9. along the curve from the curve start, and returns the point in point. point is
  10. in WCS coordinates.


  11. Returns Acad::eOk if successful. If dist is not valid for the curve, then

  12. Acad::eInvalidInput is returned. Other ErrorStatus return values are

  13. implementation-dependent.


  14. The default implementation returns Acad::eNotImplemented.

论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

发表于 2004-6-11 19:12:41 | 显示全部楼层
你可以用getStartParam 得到起点的"参数"dParamS,getEndParam 得到终点的"参数"dParamE,然后(dParamE-dParamS)/等分数,得每份的参数 n ,再用getPointAtDist(dParamS + n*i),得每等分点的坐标.
(对于cad的实体  参数 正比于 长度,自定义实体就难说了)
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|申请友链|Archiver|手机版|小黑屋|辽公网安备|晓东CAD家园 ( 辽ICP备15016793号 )

GMT+8, 2024-9-21 20:36 , Processed in 0.450046 second(s), 35 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表