Aşağıdaki <b>Poffset</b> fonksiyonuna LWPOLYLINE veya POLYLINE nesnesinin içindeki düğüm (vertex) koordinatlarını liste halinde vererek offsetini elde edebilirsiniz. Sonra bu offset koordinat listesini tekrar <b>entget</b> ile elde ettiğiniz listeye aynı sırada gömerek <b>entmake </b>(veya <b>entmod</b>) komutuyla istediğiniz nesneyi elde edebilirsiniz.
Not: İyi bir LISP editörü arıyorsanız size ConTEXT programını öneririz: [url]http://www.fixedsys.com/context[/url]. Program ücretsizdir.
[code] <font color="green">;Poffset: verilen <b>path</b>'i <b>dst</b> kadar offset eder ve yeni path'i (newpath) döndürür ;<b>dst</b> pozitif ise sağa, negatif ise sola offset yapılır. ; ;Örnek: ; path= '((2.0 2.0 0.0) (2.0 6.0 0.0) (4.0 6.5 0.0) (5.5 7.5 0.0) (9.0 7.5 0.0) (9.0 3.5 0.0) (11.0 3.5 0.0)) ; dist= 1.0 ; ;(Poffset path dist) ;Sonuç: ; '((3.0 2.0 0.0) (3.0 5.22 0.0) (4.41 5.57 0.0) (5.8 6.5 0.0) (8.0 6.5 0.0) (8.0 2.5 0.0) (11.0 2.5 0.0))</font id="green"> (defun Poffset (path dst / newpath i p1 p2 p3 aci pi/2) (setq pi/2 (* 0.5 pi)) (setq i 1 p2 (car path) p3 (cadr path)) (setq newpath (list (polar (car path) (- (angle p2 p3) pi/2) dst) )) (while (< i (1- (length path))) (setq p1 p2 p2 p3 p3 (nth (1+ i) path) ) (setq newpath (cons (polar (nth i path) (+ (angle p2 p1) (setq aci (* 0.5 (ang3P p1 p2 p3)))) (/ dst (cos (- aci pi/2))) ) newpath ) ) (setq i (1+ i)) ) (setq newpath (cons (polar p3 (+ (angle p3 p2) pi/2) dst) newpath)) (reverse newpath) )
<font color="green">;APEX-P1 ve APEX-P2 çizgileri arasındaki açıyı ölçer</font id="green"> (defun ang3p (p1 apex p2) (anginUC (- (angle apex p2) (angle apex p1))) )
<font color="green">;anginUC: ANGle measured IN Unit Circle ;verilen açıyı (ang) 0-2pi arasına indirger</font id="green"> (defun anginUC (ang) (+ (rem ang (+ pi pi)) (if (minusp ang) (+ pi pi) 0.0)) ) [/code]
|