马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
- 过三点的空间平面方程
- | x -x1 y -y1 z -z1 |
- | x2-x1 y2-y1 z2-z1 | = 0
- | x3-x1 y3-y1 z3-z1 |
- 根据拾取地形图中的高程数字计算三角形内点的高程;;
- 声明:
- 1 本程序需在WCS下执行;
- 2 高程算法可能与其它软件计算的不同
- |;
- (defun c:test ( / t1 t2 t3 elst1 elst2 elst3 h1
- h2 h3 p1 p3 p3 x1 x2 x3 y1 y2 y3
- P a b c d
- )
- (if (and (setq t1 (entsel "\nFirst text: "))
- (setq t2 (entsel "\nSencond text: "))
- (setq t3 (entsel "\nThird text: "))
- (setq p (getpoint "\nTest point: "))
- )
- (progn
- (setq elst1 (entget (car t1))
- elst2 (entget (car t2))
- elst3 (entget (car t3))
- h1 (atof (cdr (assoc 1 elst1)))
- h2 (atof (cdr (assoc 1 elst2)))
- h3 (atof (cdr (assoc 1 elst3)))
- p1 (trans (cdr (assoc 10 elst1)) 1 0)
- p2 (trans (cdr (assoc 10 elst2)) 1 0)
- p3 (trans (cdr (assoc 10 elst3)) 1 0)
- x1 (- (car p2) (car p1))
- x2 (- (car p3) (car p1))
- y1 (- (cadr p2) (cadr p1))
- y2 (- (cadr p3) (cadr p1))
- z1 (- h2 h1)
- z2 (- h3 h1)
- p (trans p 1 0)
- )
- (setq a (- (* y1 z2) (* y2 z1))
- b (- (* z1 x2) (* x1 z2))
- c (- (* y2 x1) (* y1 x2))
- d (- (+ (* (car p1) a)
- (* (cadr p1) b)
- (* (last p1) c)
- )
- )
- )
- )
- )
- (- (/ (+ (* a (car p)) (* b (cadr p)) d) c))
- )
|