home *** CD-ROM | disk | FTP | other *** search
- ;;; --------------------------------------------------------------------------;
- ;;; RPOLY.LSP
- ;;; (C) ¬⌐┼v 1988-1992 Autodesk ñ╜Ñq
- ;;;
- ;;; Ñ╗╡{ªíñwÑ╤ Autodesk ñ╜Ñq╡∙ÑU¬⌐┼v, ╢╚⌐≤ñU¡z▒í¬pñUÑi▒┬╗P▒zíu│\ÑiívíC
- ;;; ╗╒ñUñú▒oÑHÑ⌠ª≤º╬ªí╡oªµ⌐╬ÑX¬⌐ª╣╡{ªí¬║íu¡∞⌐l╜Xív; ª²ñ╣│\▒zªb»S⌐w¡lÑ═
- ;;; ¬║ñuº@ñW╡▓ªXª╣╡{ªí¬║íuÑ╪¬║╜Xív¿╧Ñ╬íCª│├÷│o├■¡lÑ═ñuº@¬║▒°Ñ≤ªpñU:
- ;;;
- ;;; ( i) │]¡pñW╗Pñuº@ñW¼╥»┬║Θ░w╣∩ Autodesk ñ╜Ñq¬║▓ú½~íC
- ;;; (ii) ╕ⁿª│íu¬⌐┼v (C) 1988-1992 Autodesk ñ╜Ñqív¬║¬⌐┼v│qºiíC
- ;;;
- ;;;
- ;;;
- ;;; AUTODESKñ╜Ñq┤ú¿╤ª╣╡{ªí╢╚¿╤º@íu├■ªⁿív¬║░╤ª╥, ª╙ÑBñú▒╞░úª│Ñ⌠ª≤┐∙╗~¬║
- ;;; Ñi»αíCAUTODESKñ╜Ñq»Sª╣º_╗{Ñ⌠ª≤»S⌐wÑ╬│~ñº╛A║┘⌐╩, ÑHñ╬░╙╖~╛P░Γ⌐╥┴⌠ºt
- ;;; ÑX¿π¬║½O├╥íCAUTODESKñ╜ÑqªP«╔ÑτñúÑX¿πª╣╡{ªí░⌡ªµ«╔ñ@⌐wñú╖|íuññ┬_ív⌐╬
- ;;; íuº╣Ñ■╡L╗~ív¬║½O├╥íC
- ;;;
- ;;;
- ;;; Written by Kelvin R. Throop in October 1985
- ;;;
- ;;; Based on the technique described in Philip J. Davis,
- ;;; "Circulant Matrices", Wiley 1979.
- ;;;
- ;;; --------------------------------------------------------------------------;
- ;;; DESCRIPTION
- ;;;
- ;;; Refinement of a random polygon by iterative replacement of
- ;;; its vertices by the midpoints of its edges. This miraculously
- ;;; transforms most random polygons into an ellipse-shaped convex
- ;;; polygon.
- ;;;
- ;;; Added error checking and an error function - April 1988
- ;;;
- ;;; Added version number, line rubberbanding and the ability to
- ;;; retain each iteration of the polygon. Jeff Wilson 12June1990
- ;;;
- ;;; --------------------------------------------------------------------------;
- (defun drawpoly (p / dp dl)
- (setq dp p)
- (setq dl (length p))
- (command "_.PLINE")
- (repeat dl
- (command (car dp))
- (setq dp (cdr dp))
- )
- (command "_C")
- )
-
- (defun myerror (s) ; If an error (such as CTRL-C) occurs
- ; while this command is active...
- (if (/= s "Function cancelled")
- (princ (strcat "\n┐∙╗~: " s))
- )
- (setvar "cmdecho" ocmd) ; Restore saved modes
- (setvar "blipmode" oblp)
- (setq *error* olderr) ; Restore old *error* handler
- (princ)
- )
-
- (defun C:RPOLY (/ olderr ocmd oblp cycno pl p pvert cyc plast pn pe pc delpoly)
- (princ "\n╜╒┼▄íuªh├Σº╬ív, ¬⌐Ñ╗ 1.1 Autodesk ñ╜ÑqíC")
- (setq olderr *error*
- *error* myerror)
- (setq ocmd (getvar "cmdecho"))
- (setq oblp (getvar "blipmode"))
- (setvar "cmdecho" 0)
- (setq cycno 0)
- (setq pl nil)
- (command "_.UNDO" "_MARK")
- (setq p1 (getpoint "\n▓─ñ@┬I: "))
- (setq pl (cons p1 pl))
- (while (setq p (getpoint p1 "\nñUñ@┬I: "))
- (command "_.LINE" p1 p "")
- (setq p1 p)
- (setq pl (cons p pl))
- )
- (command "_.UNDO" "_BACK")
- (setvar "blipmode" 0)
- (setq pvert (length pl))
- (if pl
- (progn
- (drawpoly pl)
- (initget 6)
- (while (setq cyc (getint "\n┤`└⌠ª╕╝╞: "))
- (initget "Yes No")
- (setq delpoly
- (getkword "½O»d¿Cª╕┤`└⌠¬║íuªh├Σº╬ív? <Y>/N: ")
- )
- (princ "┤`└⌠:")
- (repeat cyc
- (setq plast (nth (1- pvert) pl))
- (setq pn nil)
- (setq pe pl)
- (repeat pvert
- (setq pc (car pe))
- (setq pe (cdr pe))
- (setq pn (cons (list (/ (+ (car pc) (car plast)) 2)
- (/ (+ (cadr pc) (cadr plast)) 2))
- pn)
- )
- (setq plast pc)
- )
- (setq pl pn)
- (setq cycno (1+ cycno))
- (princ " ")
- (princ cycno)
- (if (cond
- ((= delpoly "No") t)
- (t nil)
- )
- (command "_.ERASE" "_L" "")
- )
- (drawpoly pn)
- )
- (initget 6)
- )
- )
- )
- (setvar "cmdecho" ocmd)
- (setvar "blipmode" oblp)
- (setq *error* olderr) ; Restore old *error* handler
- (princ)
- )