马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
本帖最后由 半边书生 于 2018-1-7 05:47 编辑
- (defun XD::list:Intpt_2lsts(lst1 lst2 typ / i j ii jj pt1 pt2 pt3 pt4 azi intpt interpt)
- (setq ii (length lst1))
- (setq jj (length lst2))
- ;延长lst1左侧
- (if (= (substr typ 1 1) "1")
- (progn
- (setq pt1 (nth 0 lst1))
- (setq pt2 (nth 1 lst1))
- (setq azi (angle pt1 pt2))
- (setq azi (+ pi azi))
- (setq lst1 (append (list (polar pt1 azi 10000) ) lst1 ))
- )
- )
- ;延长lst1右侧
- (if (= (substr typ 2 1) "1")
- (progn
- (setq pt1 (nth (1- ii) lst1))
- (setq pt2 (nth ii lst1))
- (setq azi (angle pt1 pt2))
- (setq lst1 (append lst1 (list (polar pt2 azi 10000) ) ))
- )
- )
- ;延长lst2左侧
- (if (= (substr typ 3 1) "1")
- (progn
- (setq pt3 (nth 0 lst2))
- (setq pt4 (nth 1 lst2))
- (setq azi (angle pt3 pt4))
- (setq azi (+ pi azi))
- (setq lst2 (append (list (polar pt3 azi 10000) ) lst2 ))
- )
- )
- ;延长lst2右侧
- (if (= (substr typ 4 1) "1")
- (progn
- (setq pt3 (nth (1- jj) lst2))
- (setq pt4 (nth jj lst2))
- (setq azi (angle pt3 pt4))
- (setq lst2 (append lst2 (list (polar pt4 azi 10000) ) ))
- )
- )
- ;计算交点坐标
- (setq ii (1- (length lst1)))
- (setq jj (1- (length lst2)))
- (setq intpt nil interpt nil i 0 )
- (while (< i ii)
- (setq pt1 (nth i lst1))
- (setq pt2 (nth (1+ i) lst1))
- (setq j 0)
- (while (< j jj)
- (setq pt3 (nth j lst2))
- (setq pt4 (nth (1+ j) lst2))
- (setq intpt (inters pt1 pt2 pt3 pt4 t) )
- (if (/= intpt nil)
- ;将交点坐标存入点表
- (setq interpt (append interpt (list intpt)))
- )
- (setq j (1+ j))
- )
- (setq i (1+ i))
- )
- interpt
- )
|