GIMP Chat http://gimpchat.com/ |
|
A little Subroutine to build Means between two Dimensional Vectors http://gimpchat.com/viewtopic.php?f=9&t=19797 |
Page 1 of 1 |
Author: | ThomasLahme [ Thu Jan 27, 2022 1:21 pm ] | ||
Post subject: | A little Subroutine to build Means between two Dimensional Vectors | ||
Dear Community, ![]() ![]() Code: Select all (define (adapt l1 l2 m) ![]() Color1 '(12 12 12) Color2 '(122 122 122) Not when the Subroutine Painter is called Which Should Paint a Rectangle Across the Screen And in the Hights y yd ![]() ![]() But it can been that this is Working, and Mistake is anywhere Else in my Program. ![]() Thomas Lahme P.S.: The Complete Program is attached. But in this Version the Canvas must Uniformy Colored, but the Program results in a Mixed Colored Image.
|
Author: | AlSchemist [ Thu Jan 27, 2022 2:26 pm ] |
Post subject: | Re: A little Subroutine to build Means between two Dimensional Vectors |
Hello
adapt is the identity function independently of l2 and m. It always returns its first operand l1. Since R => R*m - R*(m-1) = R G => G*m - G*(m-1) = G B => B*m - B*(m-1) = B Note your inversion (- 1 m) meaning that it is not an addition but a subtraction. Never use l1 or l2 because it is so clause of 11 or 12. It is about color so call them color1 and color2. Never use a parameter having only one letter such as m. It is not about mathematics! Always align parenthesis. Always give an example with the expected result. Code: Select all (define (adapt color1 color2 ratio) In the Script-Fu console: Code: Select all (adapt '(12 12 12) '(it does not matter) 0.4) The expected result will be: (12.0 12.0 12.0) |
Author: | ThomasLahme [ Fri Jan 28, 2022 9:33 am ] |
Post subject: | Re: A little Subroutine to build Means between two Dimensional Vectors |
Hey AlSchemist, I have tested your Script and have found an Error which leads me to another Error. Code: Select all > (define (adapt color1 color2 ratio) I hope you can see that I must changed the Second Color1 to Color2. This is in Because I need the Mixing between Color1 and Color2. Then I have get another Error, When I give the Subroutine equal Lists all working. But when I try to mix different Lists I got duplicated Values near the Right Result but computational Wrong. So I now have tried to address Results which are Integer-Lists, Code: Select all > (adapt '(12 12 12) '(6 6 6) 0.5) then It works perfectly I think that I have understand the Mathematical Background, and them seams correct but can Anybody find the Problem. |
Page 1 of 1 | All times are UTC - 5 hours [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |