POV-Ray : Newsgroups : povray.off-topic : Games programmers : Re: Games programmers Server Time
10 Oct 2024 15:18:48 EDT (-0400)
  Re: Games programmers  
From: Vincent Le Chevalier
Date: 12 Sep 2008 17:01:18
Message: <48cad89e$1@news.povray.org>
andrel a écrit :
> On 12-Sep-08 21:14, Vincent Le Chevalier wrote:
>> There is also a similarity between the behaviours of positive 
>> integers, multiplication and addition, and booleans, AND and OR. That is:
>>
>>  Integers            Booleans
>> a*(b+c) = a*b + a*c        a AND (b OR c) = (a AND b) OR (a AND c)
>> 0 + a = a            false OR a = a
>> 0 * a = 0            false AND a = false
>> if a>0, a+b>0 for all b        if a is true, a OR b is true for all b
>> And so on...
>>
>> It does not work out that well if you set true <-> 0.
>>
> If you take
>   true <-> 0
>   false <-> 1
>   OR <-> *
>   AND <-> +
> it works again.

No, it's not as perfect. For example the equality:
(a AND b) OR (a AND c) = a AND (b OR c)

would translate as:
(a+b) * (a+c) = a*a + a*b + a*c + b*c
	= a * (1+b+c) + b*c
	!= a + b*c

because 1+b+c is not equal to 1 in all cases.

I agree it works in the boolean sense, that is if one side is zero, the 
other is too. But you do not have the equality that you have in the 
other approach.

I'm nearly sure there is a deeper reason for that but I can't think of 
it right now.

-- 
Vincent


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.