Thursday 14 March 2013

Find Mid Points Between Two Valid Points


;; Sub Programs for Get Mid Point Between Two Points

;Method-1
(defun _Midpoint (a b)
    (list
(/ (+ (car a) (car b)) 2)
(/ (+ (cadr a) (cadr b)) 2)
    )
)
;Method-2
(defun _Midpoint (a b)
    (setq ang (angle a b))
    (setq distoff (/ (distance a b) 2))
    (polar a ang distoff)
)

;Method-3
(defun c:Test ()
    (setq a (getpoint)
 b (getpoint)
    )
    (setq ang (angle a b))
    (setq ofdist (/ (distance a b) 2))
    (setq m (polar a ang ofdist))
    (command "circle" m 2)
)

0 comments:

Post a Comment