;;;
;;; draw-arch.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-arch inImage inLayer dx dy Radius From To Lati)
(set! lung (- From To))
(set! angolo (/ lung Lati))
(set! arco (* angolo (/ 3.14 180)))
(set! aRotaz (* To (/ 3.14 180)))
(set! beta aRotaz)
(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-arch"
_"/Script-Fu/Geometry/Draw Arch..."
"Draw circle or an arch from initial angle to final angle."
"Arch. Giuseppe Conte "
"2002, Giuseppe Conte"
"14 Settembre 2002 - 72026 San Pancrazio Salentino (BR) - 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 "From angle" '(0 -9999 9999 1 10 0 1)
SF-ADJUSTMENT "To angle" '(360 -9999 9999 1 10 0 1)
SF-ADJUSTMENT "Number Segment" '(36 0 9999 1 10 0 1)
)