;;; ;;; draw-poligono.scm ;;; ;;; ;;; Arch. Giuseppe Conte ;;; ;;; Raymond Ostertag 2004/09 changed menu entry ;;; This program is free software; you can redistribute it and/or modify ;;; it under the terms of the GNU General Public License as published by ;;; the Free Software Foundation; either version 2 of the License, or ;;; (at your option) any later version. ;;; ;;; This program is distributed in the hope that it will be useful, ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License ;;; along with this program; if not, write to the Free Software ;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ;;; Define the function: (define (script-fu-draw-polygon inImage inLayer dx dy Radius Lati) (set! angolo (/ 360 Lati)) (set! arco (* angolo (/ 3.14 180))) (set! beta 0) (set! gamma 0) (set! gcount 1) (set! npoint 4) (let* ( (segment (cons-array 4 'double)) (stepx dx) (stepy dy) (raggio Radius) (nlati Lati) ) (while (<= gcount nlati) (set! beta (+ beta arco)) (set! gamma (- beta arco)) (aset segment 0 (+ (* raggio (cos gamma)) stepx)) (aset segment 1 (+ (- (* raggio (sin gamma))) stepy)) (aset segment 2 (+ (* raggio (cos beta)) stepx)) (aset segment 3 (+ (- (* raggio (sin beta))) stepy)) (gimp-pencil inLayer npoint segment ) (set! gcount (+ gcount 1)) );end while (gimp-displays-flush) );;let ) ;;def (script-fu-register "script-fu-draw-polygon" _"/Script-Fu/Geometry/Draw Polygon..." "Draw all regular polygonos." "Arch. Giuseppe Conte " "2002, Giuseppe Conte" "08 Maggio 2002 - Florence - Italy" "RGB* GRAY* INDEXED*" SF-IMAGE "The Image" 0 SF-DRAWABLE "The Layer" 0 SF-ADJUSTMENT "X center" '(0 0 9999 1 10 0 1) SF-ADJUSTMENT "Y center" '(0 0 9999 1 10 0 1) SF-ADJUSTMENT "Radius" '(10 0 9999 1 10 0 1) SF-ADJUSTMENT "Number of segment" '(3 0 9999 1 10 0 1) )