求解交点个数的程序!

2009-05-18 04:23:18 AM

求解交点个数的程序!

更多相关内容请访问"CAD家园论坛",万人专家团为您在线答疑!


我在工作中最费劲的就是数许多直线交点个数,请问那位高手可以编制此类LISP,ARX程序给我帮忙一下?感激不尽!


该不是所有直线的所有交点吧!你应该贴张图说明一下,到底是什么样的直线,什么样的交点,是哪个专业方面的。


用(la-IntersectWith obj1 obj2 mode) 函数编程.




用XDRX_API 函数xdrx_getinters 一个函数搞定一切


请教:
如何用lisp建立选择范围内的所有交点选择集(多条直线与1条spline线)。
谢谢谢




获得直线选择集SS,SPLINE实体名e

那么:

(setq ints (xdrx_getinters e ss))

获得SPLINE和所有直线的交点。


我的意思是:在机械制图绘制换热器排管图中要求计算换热管数量,如何能够以求多条直线交点数量的办法获得!
麻烦各位高人了!




要R14版求多条直线交点数量-难道真的不存在高人吗?


参考:
SweepLine.lsp by Daniele Piazza.
This is a "SWEEPLINE algorithm to compute all intersection points of n line segments"
(Preparata & Shamos - Computational Geometry: an introduction)
This is again academic code and should be used if you expect a huge number of lines to intersect and you are looking for all intersection points. (sweepline) should run in O(n*logn), but the shell sort in AutoLISP is too slow.


;;; Otherwise a greedy method like this is sufficient:
;;; O(n*2), exactly: O(n*(n-1))
;;; test each line with all other lines
;;; segments: ((p1 p2)(p1 p2)...)
(defun greedy-all-intersections (segments / seg1 rest seg2 pt pts)
(setq rest segments)
(foreach seg1 segments
(setq rest (cdr rest))
(foreach seg2 rest
(if (setq pt (inters (car seg1)(cadr seg1)(car seg2)(cadr seg2) T))
(setq pts (cons pt pts)))))
pts
)

Extensions:
It is possible to add bulged segments too by extending the data structure "segment" with (p1 p2 bulge) for cured segments and use a line-arc resp. arc-arc intersection method for those. Then a straight segment is still representable with (p1 p2)



R14下不用ARX或者lisp,仅用Lisp求交点(spline、含弧的pline、ellipse、arc),没戏。
LUCAS贴过一个求选择集交点的函数(ActieX方法)


问英雄何处?聚晓东空间否,高人何处?呜乎哀哉!

0 条评论:

发表评论

订阅 帖子评论 [Atom]

<< 主页

0.0025069713592529