[rrd-users] Re: RPN Tutorial with logical operators (AND/OR)?
Laurent LEVIER
llevier at argosnet.com
Sun May 2 18:09:27 MEST 2004
At 17:25 02/05/2004, Hugo van der Kooij wrote:
>On Sun, 2 May 2004, Laurent LEVIER wrote:
>
>All of them are maths. The first * does work as the AND operator but the
>+ does not at all. I am not a RPN expert however.
Ok, so '*' means AND. That's what I was suspecting.
>You need to play the stack game and rewrite it part by part to a more
>common notation to figure this one out.
>
>C2=in,$L2,LT,in,$L1,GE,*,in,$L1,-,0,IF,in,$L2,GT,$L1,0,IF,+
>
> Compare L2:
>C2 = (in < $L2) ,in,$L1,GE,*,in,$L1,-,0,IF,in,$L2,GT,$L1,0,IF,+
> Compare L1:
>C2 = (in < $L2) (in >= $L1) ,*,in,$L1,-,0,IF,in,$L2,GT,$L1,0,IF,+
> Multiply these results (which equals to AND):
>C2 = ((in < $L2) * (in >= $L1)) ,in,$L1,-,0,IF,in,$L2,GT,$L1,0,IF,+
> Lower with L1:
>C2 = ((in < $L2) * (in >= $L1)) (in - $L1) ,0,IF,in,$L2,GT,$L1,0,IF,+
>
> Now rewrite in more common format:
>
>IF ((in < $L2) * (in >= $L1))
>THEN C2a = (in - $L1)
>ELSE C2a = 0
Ok, that's what I was thinking. I am lucky until now!
> So where did C2a come from? Well, I needed a place holder as we
> haven't finished yet.
>
>C2b = in,$L2,GT,$L1,0,IF
>C2b = (in > $L2) ,$L1,0,IF
>
> In more common format:
>IF (in > $L2)
>THEN C2b = $L1
>ELSE C2b = 0
>
> And finaly:
>
>C2 = C2a + C2b
Ok, so this '+' is really used to add the results of the 2 IF. This was my
best assumption to the logic of this line, but I was not sure.
>The problem here lies that it only works if you use even spaced color
>intervals. But if these intervals are not equaly divided you should not
>use $L1 but ($L2 - $L1). Which would in the end result in:
>
>CDEF:C2=in,$L2,LT,in,$L1,GE,*,in,$L1,-,0,IF,in,$L2,GT,$L2,$L1,-,0,IF,+
>
>BTW: I assume here that $Lx stands for the color seperation levels.
Yes, L1...L18 are values for color range from Green to Red.
For interested people, it is simply adding 0x20 on colors:
Starting at Green: #00FF00
Towards Yellow: #FFFF40
Until Red: #FF0000
Here is the full list, I attached an example of the result. Looks like
Arizona with grass.
"AREA:C1#00FF00" \
"STACK:C2#20FF08" \
"STACK:C3#40FF10" \
"STACK:C4#60FF18" \
"STACK:C5#80FF20" \
"STACK:C6#A0FF28" \
"STACK:C7#C0FF30" \
"STACK:C8#E0FF38" \
"STACK:C9#FFFF40" \
"STACK:C10#FFE038" \
"STACK:C11#FFC030" \
"STACK:C12#FFA028" \
"STACK:C13#FF8020" \
"STACK:C14#FF6018" \
"STACK:C15#FF4010" \
"STACK:C16#FF2008" \
"STACK:C17#FF0000" \
"STACK:C18#FF0000" \
The principle is basically simple. If value > upper level of color, then
AREA (or STACK from 2nd to... layer) return upper-lower value.
Else return entry value - lower
Finally, stack it on the previous drawn layer.
After a while for the last color, simply stack the entry point - lower
layer value
Many thanks for that explanation.
I may finally be able to draw that graphic properly.
Brgrds
Laurent LEVIER
Systems & Networks Security Expert, CISSP CISM
-- Attached file removed by Ecartis and put at URL below --
-- Type: image/gif
-- Size: 31k (32728 bytes)
-- URL : http://www.ee.ethz.ch/~slist/p/Temps-7d.gif
--
Unsubscribe mailto:rrd-users-request at list.ee.ethz.ch?subject=unsubscribe
Help mailto:rrd-users-request at list.ee.ethz.ch?subject=help
Archive http://www.ee.ethz.ch/~slist/rrd-users
WebAdmin http://www.ee.ethz.ch/~slist/lsg2.cgi
More information about the rrd-users
mailing list