马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
相关介绍
http://www.xdcad.net/forum/thread-668040-1-1.html
![](source/plugin/imc_colorcode/images/loading.gif) - ;;点集二乘圆圆心
- (defun pnts:center2 (pts / lst l)
- (setq pts (mapcar '(lambda (x / an r)
- (setq an (angle '(0.0 0.0 0.0) x)
- r (distance '(0.0 0.0) x)
- )
- (list (* r (cos an)) (* r (sin an)))
- )
- pts
- )
- l (length pts)
- )
- (list (/ (* 2 (apply '+ (mapcar 'car pts))) l)
- (/ (* 2 (apply '+ (mapcar 'cadr pts))) l)
- )
- )
- (defun c:tt (/ e pts pcen pl3d ray3d cc3d an an1 p ptl pt)
- (if (setq e (car (entsel)))
- (progn
- (setq pts (xdrx_getsamplept e)
- pcen (apply 'xdrx_points_centroid pts)
- pl3d (xdge::constructor e)
- ray3d (xdge::constructor "kRay3d");_构造 Ray3d
- cc3d (xdge::constructor "kCurveCurveInt3d");_构造相交体
- an 0.
- an1 (/ pi 180)
- )
- ;;以中心为原点对多边形进行等角度分割采样
- (repeat 360
- (xdge::setpropertyvalue ray3d "set" pcen (polar pcen an 1.));_重新设置 Ray3d
- (xdge::setpropertyvalue
- cc3d "set" pl3d ray3d '(0.0 0.0 1.0));_重新设置相交体
- (if (/= (xdge::getpropertyvalue cc3d "numIntPoints") 0)
- (setq ptl (cons (xdge::getpropertyvalue cc3d "intPoint" 0) ptl);_求交点
- an (+ an an1)
- )
- )
- )
- (xdrx_point_make pcen);_质心
- (xdge::free)
- (setq p (pnts:center2
- (mapcar '(lambda (x) (mapcar '- x pcen)) ptl)
- );_二乘圆圆心
- pt (xdrx_point_make (mapcar '+ pcen p))
- )
- (xdrx_entity_setcolor pt 1)
- )
- )
- (princ)
- )
下载地址:晓东文库
|