flopo 发表于 2022-7-6 09:02:59

大家好,
我有一个lisp,点定义为j1,j2。。。。。。有时候我只能有j1。。。j6,有时是j1。。。我正试图这样计算y的最低点
(SETQ PMIN (MIN (CADR J1) (CADR J2 )(CADR J3 )(CADR J4 )(CADR J5 )(CADR J6 )(CADR J7 )
          (CADR J8 )(CADR J9 )(CADR J10 )))
 
当我只有j1。。。j5不工作(当然!!)。怎么做?要添加哪些条件才能使其生效?
...如果j6存在,那么。。。。
怎么做?谢谢

BlackBox 发表于 2022-7-6 09:08:45

考虑使用MAPCAR函数。
 
下面是一个小示例,使用在WCS中绘制的矩形坐标,然后旋转5度(很明显,一个顶点是最低的):
 

(defun _LowYcoord(pointList)
(car (vl-sort (mapcar 'cadr pointList) '<))
)

flopo 发表于 2022-7-6 09:11:42

轻微修改:
 

_LOWYCOORD
_$ (_LowYcoord '((-11.1758 20.4623 0.00) (2.19028 21.6316 0.00) (3.11153 11.1017 0.00) (-10.2546 9.93234 0.00)))
9.93234
_$

 
*向艾伦致敬*

alanjt 发表于 2022-7-6 09:11:59

同上的问题。。。热到设定点??

BlackBox 发表于 2022-7-6 09:15:04

 
与上面的回答相同。。。
 
下面是控制台使用此函数的(其他)示例:
 
(SETQ POINTLIST (LIST 'J1 'J2 'J3 'J4 'J5 'J6 'J7 'J8 'J9 'J10))


(SETQ PCOTAMIN (car (vl-sort (mapcar 'cadr pointList) '<)))

flopo 发表于 2022-7-6 09:19:22

 
你好你好你好你好
 

BlackBox 发表于 2022-7-6 09:23:38

flopo 发表于 2022-7-6 09:25:32

Same question as above...hot to set that point??

BlackBox 发表于 2022-7-6 09:29:22

 
Same response as above...
 
Here's an(other) example from Console using this function:
 

_LOWYCOORD _$ (setq J1 '(-11.1758 20.4623 0.00))(-11.1758 20.4623 0.0)_$ (setq J2 '(2.19028 21.6316 0.00))(2.19028 21.6316 0.0)_$ (setq J3 '(3.11153 11.1017 0.00))(3.11153 11.1017 0.0)_$ (setq J4 '(-10.2546 9.93234 0.00))(-10.2546 9.93234 0.0)_$ (setq pointList '(J1 J2 J3 J4))(J1 J2 J3 J4)_$ (setq pMin (_LowYcoord pointList))(-10.2546 9.93234 0.0)_$

pBe 发表于 2022-7-6 09:31:08

 

Hello... Hello.. Hello... Hello....
 
页: 1 [2]
查看完整版本: 最低y值-坐标fo