你好
该代码的思想是在多段线选择集中检测90度角。所以在检测到顶点配对后,我想把它们存储在一个数据库中
由于每对顶点都存储为数据库列表中的列表,因此我需要访问nasted列表并防止重复。
如何将红线转换为有效的mapcar函数?
- ;;;--------------------------------------------------------------------;
- ;;; Function: createCornerVertexList ;
- ;;;--------------------------------------------------------------------;
- ;;; Description: analyzes a given 2d vertices list by comparing every ;
- ;;; pair of vertices for all possible distances and ;
- ;;; angles, and create a new list of 2d vertices only if ;
- ;;; they form 90 degrees corner.
- ;;; NOTE : every pair of vertices compose an entry
- ;;; Argument : lst - 2d vertices list ;
- ;;;--------------------------------------------------------------------;
- ;;; anglein radianc but for comprance ;
- ;;; porpuses,there is a need for the ;
- ;;; (<) and (>)functionsthe get 0 or ;
- ;;; (* pi 2) as arguments ;
- ;;; MAXDISTANCE - the maximum distance allowed between 2 ;
- ;;; pointsto be listed as a corner pair ;
- ;;; vertices. ;
- ;;; MINDISTANCE - the minimum distance allowed between 2 ;
- ;;; vertecis to be listed as a corner ;
- ;;; vertices. ;
- ;;; notice that this constant prevent ;
- ;;; vertex to be compared to it self and ;
- ;;; other verticesin a door or a window ;
- ;;; posts. ;
-
- (defun MMDPOLY1:createCornerVertexList(lst / ma fe col corners )
- (setq fe 0 ma 0)
- (while (< ma (length lst))
- (while (< fe (length lst))
- (if(MMDPOLY.isCornerForm (nth ma lst)(nth fe lst) MINDISTANCE MAXDISTANCE)
- (progn
- [color="red"][b] ;_if [corners] is empty
- ;_if (nth ma lst) or (nth fe lst) are not member of any of [/b][/color]the sublists
- (setq database (cons (list (nth ma lst)(nth fe lst))corners))
- );_if
- );_if
-
-
- (setq fe (1+ fe))
- );_while (fe
- (setq ma (1+ ma))(setq fe 0)
- ) ;_while (ma
- )
谢谢
谢伊 |