|
|
So, I did some more testing, wrote a simple, standalone sample scene, and found
yet another curious set of circumstances.
And it looks like probably what's happening is another case of floating point
math error, similar to what I experienced way back when trying to use fractional
loop iterators.
Sometimes the 4-value version works (as expected), and sometimes it doesn't.
Always a headache, with the simplest things.
- BW
#version 3.8;
global_settings {assumed_gamma 1}
default {finish {diffuse 1}}
#declare E = 0.001;
#declare Zoom = 700;
camera {
orthographic
location <0.5, 0.5, -50>
right x*image_width/Zoom
up y*image_height/Zoom
look_at <0.5, 0.5, 0>
rotate y*0
}
sky_sphere {pigment {rgb 0}}
light_source {<1, 1, -10> rgb 1}
#declare LW = 0.01;
#declare f_XLines = function {pigment {gradient y scale 0.1}}
#declare XLines = function {select (f_XLines (x, y, z).red-LW, 1, 0)}
#declare f_YLines = function {pigment {gradient x scale 0.1}}
#declare YLines = function {select (f_YLines (x, y, z).red-LW, 1, 0)}
#declare Grid = function {XLines (x, y, z) + YLines (x, y, z)}
box {0, 1+E pigment {function {Grid (x, y, z)}} }
#declare Select3 = function (N) {
select (N*10-2, 0.1,
select (N*10-5, 0.4,
select (N*10-7, 0.6,
0.9
)
)
)
}
// In this version, when N-Val = 0 --- when N=Val,
// then the repeated value, argument B, should get returned.
#declare Select4 = function (N) {
select (N-0.2, 0.1, 0.1,
select (N-0.5, 0.4, 0.4,
select (N-0.7, 0.6, 0.6,
0.9
)
)
)
}
#declare Line = 0.0015;
#declare Step = 0.05;
union {
#for (X, 0, 1, Step)
#local Y = Select3 (X);
#debug concat( "X = ", str(X, 0, 3), " Y = ", str(Y, 0, 3), "\n")
#local Current = <X, Y, 0>;
sphere {Current Line}
#if (X > 0)
cylinder {Last, Current, Line}
#end
#local Last = Current;
#end
pigment {rgb x}
}
#debug "\n===========================================\n"
union {
#for (X, 0, 1, Step)
#local Y = Select4 (X);
#debug concat( "X = ", str(X, 0, 3), " Y = ", str(Y, 0, 3), "\n")
#local Current = <X, Y, 0>;
sphere {Current Line}
#if (X > 0)
cylinder {Last, Current, Line}
#end
#local Last = Current;
#end
pigment {rgb z}
}
Post a reply to this message
Attachments:
Download 'selecttest.png' (28 KB)
Preview of image 'selecttest.png'
|
|