- ;; xyp-Sort-PList 点集实体排序 (xyp-Sort-Plist lst mode) mode 1~10
- (defun xyp-Sort-PList (lst mode / x y)
- (defun aaa (lst fun1 fun2 / x y x1 x2 y1 y2)
- (vl-sort lst
- '(lambda (x y)
- (setq x (trans (car x) 0 1)
- y (trans (car y) 0 1)
- x1 (car x)
- x2 (car y)
- y1 (cadr x)
- y2 (cadr y)
- )
- (cond ((and (= x1 x2) (= y1 y2) (> (caddr x) (caddr y))) T)
- ((and (= y1 y2) (fun1 x1 x2)) T)
- ((fun2 y1 y2) T)
- (T nil)
- )
- )
- )
- )
- (defun bbb (lst fun1 fun2 / x y x1 x2 y1 y2)
- (vl-sort lst
- '(lambda (x y)
- (setq x (trans (car x) 0 1)
- y (trans (car y) 0 1)
- x1 (car x)
- x2 (car y)
- y1 (cadr x)
- y2 (cadr y)
- )
- (cond ((and (= x1 x2) (= y1 y2) (> (caddr x) (caddr y))) T)
- ((and (= x1 x2) (fun1 y1 y2)) T)
- ((fun2 x1 x2) T)
- (T nil)
- )
- )
- )
- )
- (cond ((= mode 1) (aaa lst < >)) ; 上→下,左→右
- ((= mode 2) (aaa lst > >)) ; 上→下,右→左
- ((= mode 3) (aaa lst < <)) ; 下→上,左→右
- ((= mode 4) (aaa lst > <)) ; 下→上,右→左
- ((= mode 5) (bbb lst > <)) ; 左→右,上→下
- ((= mode 6) (bbb lst < <)) ; 左→右,下→上
- ((= mode 7) (bbb lst > >)) ; 右→左,上→下
- ((= mode 8) (bbb lst < >)) ; 右→左,下→上
- ((= mode 9) (vl-sort lst '<)) ; 单一数值从小到大
- ((= mode 10) (vl-sort lst '>)) ; 单一数值从大到小
- )
- )
|