|
![](/i/fill.gif) |
"marabou" <not### [at] available yet> wrote in message
news:454a3d41@news.povray.org...
> hello,
> I want to check if one point at spline-creation time is
> equal to one point in an array.
> ... snip ...
> #if ( splinepath(clock_counter) = splinepoints[10] )
> ... snip ...
> Then comes a parse error: "Float expected but vector or color expression
> found."
> And I ask: Why is splinepath(at_one_moment) no vector? What did I wrong?
>
Hi,
splinepath(clock_counter) does return a vector, but, in an #if statement you
need something that evaluates to a 'float expression that is interpreted as
a boolean value' and vector1=vector2 doesn't give you that, which is why you
get the error that complains that it came across a vector rather than
finding a float.
I believe you'll need to test the individual elements of the vector, (though
someone may know an easier way):
#declare A = <1,1,1>;
#declare B = <1,1,1>;
#if (A.x=B.x & A.y=B.y & A.z=B.z)
sphere {0,1 pigment {color rgb 1}}
#end
Also, even if the condition is theoretically met, you may well run into
precision errors that you'll need to deal with.
ie if splinepath(clock_counter) returns <1.0000001,0.999999999,1.000000005>
then you'll need to handle that in your logic.
Typically you could end up with something like:
#declare Threshold = 0.001;
#if (A.x-B.x<Threshold &
A.y-B.y<Threshold &
A.z-B.z<Threshold)
Regards,
Chris B.
Post a reply to this message
|
![](/i/fill.gif) |