lin中点之间的距离
hii我有一张有4行点的图(每行点的Y轴相同)。我有一个列表中每一行的点的坐标和一个列表中所有列表的坐标。
现在我想计算每个列表中点之间的距离,知道直线中的点的数量可能会改变,并且可能不相等,如下所示:
.....
.....
.. ..
...
因此,我创建了一个lisp,可以测量距离,但唯一的问题是,只有当直线具有相同数量的点时,我才能计算距离。
请再次帮助我,对不起,我的英语不好 你能把你的密码寄出去吗?
它在哪里?
(defun LM:GroupByFoo ( lst foo )
(if lst
(cons
(cons (car lst)
(vl-remove-if-not '(lambda ( x ) (foo (cadr lst) x)) (cdr lst))
)
(LM:GroupByFoo (vl-remove-if '(lambda ( x ) (foo (car lst) x)) (cdr lst)) foo)
)
)
)
(defun c: test (all /)
(setq lall(length all))
(setq f -1)
(setq sorty (list))
(while ( < (setq f (1+ f)) lall)
(setq allc (vl-sort
(LM:GroupByFoo (nth f all)
(lambda ( a b ) (equal (cadr a) (cadr b)))
)
'(lambda ( a b ) (< (cadar a) (cadar b)))
)
)
(setq sorty (append sorty (list allc)))
)
(setq ls (length sorty))
(setq lallc(length allc))
(setq n -1)
(setq sortall(list))
(while ( <(setq n (1+ n)) ls)
(setq m -1)
(setq sortx (list))
(while ( < (setq m (1+ m)) lallc)
(setq xx0 (vl-sort (nth m (nth n sorty))
(function (lambda (e1 e2)
( < (car e1) (car e2)) ) ) ))
(setq sortx (append sortx (list xx0)))
)
(setq sortall(append sortall (list sortx)))
)
(setq Ldie(length sortall))
(setq di1 (nth 0 sortall))
(setq l1 (length (nth 0 sortall)))
(setq ty -1)
(setq lleny (list))
(while (< (setq ty (1+ ty)) l1)
(setq lleny (append lleny (list (length (nth ty di1)))))
)
(princ lleny)
(setq diste (list))
(setq dislist (list))
(setq t -1)
(while ( <(setq t (1+ t)) l1)
(setq r -1)
(setq q 0)
(setq diste (list))
(while (and (< (setq r(1+ r)) 4)( < (setq q (+ 1 q)) 4))
(setq di (distance (nth r (nth t (nth 0 sortall))) (nth q (nth t (nth 0 sortall)))))
(setq diste (append diste ( list di)))
)
(setq dislist(append dislist (list diste)))
)
那么也许:
(defun test (all / )
;; <-- Your code here
是的,我的列表就是这种格式的,我想计算(和)、(和)。。。。。。和) 试试我的测试代码。。。 谢谢你,李,成功了。谢谢你的帮助。事实上,我已经困了三天了 Renderman, you are right. English isn't my native language, I live in Iran, but you live Somewhere between Civil 3D and Maya, which means your language isn't Persian.
Ahankhah, I mean no offense to you, my friend.
I simply tried to provide an example to your correct statement, as when I began programming LISP, I would not have understood fully. For me, sometimes 'seeing' an example helps me to understand.
I assure you, your English is far superior to my Persian.
页:
[1]
2