Because AlSchemist
strongly simplified the code reducing the number of lines of scheme from 716 to 147
There were 105
set! instructions in release 12. There is zero
set! in release 13, which introduces the
case function known as
switch in other languages.
Moreover, the
deprecated legacy
gimp-drawable-set-name has been replaced with modern
gimp-item-set-name.
A standard optimization about arithmetic
binary operator is to use the less known
ternary operator:
Copy in the clipboard the following expression and paste it in the input area of the Script-Fu console: Alt+filte(
R)s > (
S)cript-Fu > (
C)onsole
;-> composition of binary operators returns 8 - 2 - 1 = 5;-> ternary operator returns also 5
What AlSchemist prefers is the
unusual usage of the
And ![Sun glasses :sglasses](./images/smilies/bigglasses.gif)
operator returning the value of its last parameter if all previous parameters did not fail.
So we introduce the functions
circle,
cone and
triangle inside the initialization of local variables.
(case shapeType ; Calculate y distance combined with x2 to get point on circumference
((0)(let* ( (b1 (and (define (circle x)(sqrt (- (pow rad 2) (pow (abs (- rad x)) 2)))) (circle x1))) (b2 (circle x2)))
(transf #t layerWrd (+ x-rad x1) (- ctry b1) (+ x-rad x2) (- ctry b2) (+ x-rad x1) (+ ctry b1) (+ x-rad x2) (+ ctry b2))
) )
) ; etc.
Attachment:
AngelaDavis.jpg [ 205.22 KiB | Viewed 711 times ]