|
|
In article <3a3eca06@news.povray.org>, "Andy Cocker"
<big### [at] mariner9fsnetcouk> wrote:
> Would I be correct in thinking that the ! stands for 'does not', and
> the | signifies 'and', thus the code reads "unless the trace function
> returns <0,0,0>, then parse the following.. otherwise goto #else"?
Close, very close:
"!" means "not", like you said, so "!=" means "is not equal to". "|"
means "or", not "and", so this statement:
#if(Norm.x != 0 | Norm.y != 0 | Norm.z != 0)
A
#else
B
#end
Means:
"If Norm.x is not 0, or if Norm.y is not 0, or if Norm.z is not 0, do A,
otherwise do B."
In other words:
"If any component of Norm is not 0, do A, otherwise do B."
The "&" symbol means "and", so it could also be written as:
#if(!(Norm.x = 0 & Norm.y = 0 & Norm.z = 0))
Which translates nicely into English as:
"If not all the components of Norm are equal to 0..."
And the reason for all this is that you can't compare normals...I
usually use a vEq(V1, V2) macro:
#if(!vEq(Norm, < 0, 0, 0>))
or a vNull(V) macro:
#if(!VNull(Norm))
--
Christopher James Huff
Personal: chr### [at] maccom, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tagpovrayorg, http://tag.povray.org/
<><
Post a reply to this message
|
|