|
|
Hi guys.
I have all this code for making a little animation and i noted something
strange.
I'm developing a boolean macro that returns true when a float passed as
parameter is an "integer" value.
////////////////////////////////////////////////////////
#declare STEP=0.25;
#include "colors.inc"
#macro drawSpline(s,i,j,step)
union{
#local counter=i;
#while(counter<=j)
object{sphere{0 0.1 translate s(counter)}}
isInteger(counter)//this only print a message
#local counter=counter+step;
#end
}
#end
#macro isInteger(f)
#debug concat("f:",str(f,0,2)," floor(f):",str(floor(f),0,2),"
f-floor(f):",str(f-floor(f),0,2),"n")//last is a newline char
#end
#declare path=spline{
natural_spline
0,<-2,0,-1>
1,<1,0,-3>
2,<3,0,-1>
3,<2,0,2>
4,<-3,0,2>
}
object{drawSpline(path,0,4,STEP) pigment{Cyan}}
union{
object{sphere{0 0.2 translate path(0)}}
object{sphere{0 0.2 translate path(1)}}
object{sphere{0 0.2 translate path(2)}}
object{sphere{0 0.2 translate path(3)}}
object{sphere{0 0.2 translate path(4)}}
pigment{Yellow}
}
cylinder{0 x*1000 0.05 pigment{Red}}
cylinder{0 z*1000 0.05 pigment{Blue}}
cylinder{0 y*1000 0.05 pigment{Green}}
camera{location <-2,3,-5> look_at <0,0,0>}
light_source{<-5,3,-2>*1000 White*1.8}
light_source{<2,7,-5>*1000 White*0.8 shadowless}
plane{y 0 pigment{checker White,Gray80 scale 1}}
////////////////////////////////////////////////////////
When u render the scene u get some debug messages at the debug window.
With STEP=0.25 i see that floor(1) is 1.00 so f-floor(f) is 0.00 and works
fine
With STEP=0.1 i see that floor(1) is 0.00 so f-floor(f) is 1.00 and should
be 0.00
I really don't know why.
A bug, my fault ?
Manuel Mata
http://www.ignorancia.org/mmata
Post a reply to this message
|
|