# [Tkinter-discuss] Calculating a ripening tomato

Douglas S. Blank dblank at cs.brynmawr.edu
Tue Oct 18 18:37:38 CEST 2011

```On 10/18/2011 12:15 PM, Bob Greschke wrote:
>
> On Oct 18, 2011, at 00:19, Greg Ewing wrote:
>
>> Bob Greschke wrote:
>>> 2.7 being close to e. I should have known the "natural" log would
>>> be involved somehow, even though most tomatoes these days are far
>>> from natural.
>>
>> Resemblance to e probably doesn't have much to do with it -- more
>> likely your formula is just preventing the overall brightness of
>> the colour from getting too low, thus avoiding brown.
>>
>> Another way to approach this might be to do the interpolation in
>> HSB space, varying the hue angle from red to green while keeping
>> the brightness constant, and then convert to RGB.
>>
>> -- Greg
>
> Oh, agreed.  That sounds like a better way to do this, but for a
> quick and dirty approach I messed for quite a while with just red and
> green rates and tossed in several different if-statements to mess
> with things here an there, but then just threw all of that out and
> tried the **2.7 and it all of a sudden was pretty close to what I had
> in mind.  I've since altered it to start with a bit of red
>
> R = 65+(190-int((Pct**2.718)*190.0)) G = int(Pct*255.0)
>
> It still spends a little too much time in a tanish-orangeish area for
> my taste, but it's good enough for this exercise.  I wouldn't dismiss
> e too quickly.  It pops up in some weird places.
>
> Now I'm wondering about being able to calculate things like going
> from dark green through to white for land elevations, and the colors
> of the rainbow in the right order, light blue to dark blue for water
> depths (that one is easy), etc.  I'll have to look into this when I
> get some time.
>
> Thanks!
>
> Bob

Although this is pretty off-topic for the Tkinter mailing list, I look
available.

Also, if anyone has first-principle arguments or equations, that would
be interesting.

(Off-list I would also like some pointers on the strange places where e
makes appearances.)

Thanks, and sorry for the additional noise,

-Doug

>
> _______________________________________________ Tkinter-discuss
> mailing list Tkinter-discuss at python.org
> http://mail.python.org/mailman/listinfo/tkinter-discuss
>

--
Douglas S. Blank, Associate Professor and Chair
Department of Computer Science, Bryn Mawr College
http://cs.brynmawr.edu/~dblank  (610)526-6501
```