|
![](/i/fill.gif) |
Included is a scene file (as simple as I could make it) that exhibits a bug. I
am not quite sure about its nature, but this is what I've discovered:
* The bug causes cones to be placed erroneously;
* It affects cones, but cylinders are unaffected;
* Increasing the number of segments amplifies the effect;
* Making cone radii constant eliminates the effect;
* Increasing the randomness does not amplify the effect but rather gives
different patterns of misalignment (?);
* Using the same randomness on all axes eliminates the effect, it is more
visible when the axes have more different randomness;
* Two rand seeds with which I've observed the effect are 1322 and 1342
* It seems to be caused by using more than 2 decimal places in cone point
coordinates and/or radii, less than 2 decimal places -> no errors;
My script otputs cone statements to a file; when more than 2 decimal places are
used, the effect is also seen when rendering this file. Inspection of the
coordinates shows that they are correct (cone end coordinate = next cone start
coordinate), therefore the error is not in my script.
I tested it on several machines, with POVWin 3.1 and POVDOS 3.1
Margus
//BEGIN SCENE
camera {orthographic location <0,1,2> up 60*.75*y right 60*x look_at z*2}
light_source {<20,60,-10> color 1}
#include "colors.inc"
//NumSegm number of segments
//RND randomness in X,Y and Z directions (vector expression)
//Seed random number seed
#macro Worm(NumSegm, RND, Seed)
#declare CurSegm = 0;
#declare PointStart = <0,0,0>; //Segment start point
#declare PointEnd = <0,0,1>; //Segment end point
#declare RadStart = 1; //Segment start radius
#declare R1 = seed(Seed);
#fopen TMP "wrmtemp.inc" write
#declare DP = 3; //decimal places of start/end point coordinates
#declare DR = 3; //decimal places of start/end radii
union {
#while (CurSegm < NumSegm)
#declare CurSegm=CurSegm+1;
#declare RadEnd = 1-CurSegm/NumSegm;
cone {PointStart, RadStart, PointEnd, RadEnd}
#declare PointNew=PointEnd+vrotate(PointEnd-PointStart,
<RND.x*(rand(R1)-0.5),
RND.y*(rand(R1)-0.5),
RND.z*(rand(R1)-0.5)>);
#write (TMP, "cone {<",str(PointStart.x,0,DP)",",
str(PointStart.y,0,DP)",",
str(PointStart.z,0,DP)">,",
str(RadStart,0,DR),",<",
str(PointEnd.x,0,DP)",",
str(PointEnd.y,0,DP)",",
str(PointEnd.z,0,DP)">,",
str(RadEnd,0,DR),
" pigment{Red} finish{ambient .3}}\n")
#declare PointStart=PointEnd;
#declare PointEnd=PointNew;
#declare RadStart=RadEnd;
#end}
#end
object {Worm(350,<0,1,0>,1322) pigment{Red} finish{ambient .3}}
Post a reply to this message
|
![](/i/fill.gif) |