|
|
Le 27/12/2012 19:28, Albun nous fit lire :
>
> Well, i try to change color with vector's comparison. Subtraction , or equal
> can't give a result to change color.
> And substraction (Pos_-Pos_compare) can't be recognize. I want to change color
> when the two vectors are the same, in substraction equal to 0 ,=0.
> I use trace() for one vector.
>
Caveat: 3D vectors are using floating point arithmetic, strict equality
is unlikely to occurs due to noise on floating point operations. (e.g. :
A=<2,4,5>/10; B=<2,4,5>/20; C=B+B+B; D=A+B; ... does D == C ? not sure!)
I would recommend computing the square length of the difference, and
testing it for "small enough" (not =0).
#declare DeltaLenSquared = vdot((Pos_ - Pos_compare),(Pos_ - Pos_compare));
#if (DeltaLenSquared < 0.01)
If you want slower (due to a square root):
#declare DeltaLen = vlength(Pos_ - Pos_compare);
#if (DeltaLen < 0.1)
> ////
>
> #declare PointA = VEq(Pos_,Pos_compare);
>
>
> sphere{Pos_,.25
> #if (0=PointA)
> pigment{White}
> #else
> pigment{Gray30} #end }
>
>
> ////
>
> Thanks so
>
>
>
>
Post a reply to this message
|
|