// This "test.pov" file demonstrates the BUG I have found // in "triangle.c" from the povray 3.1g source code. #include "colors.inc" #include "woods.inc" #include "glass.inc" #include "golds.inc" #declare Triangle = 1; // for the sphere buildt from smooth_triangles. // #declare Triangle = 0; // for the comparison with a normal sphere. #declare Scaled = 1; // The scaled "smooth_triangle sphere" is damaged. // #declare Scaled = 0; // Unscaled sphere, no problems occur here. #declare Nu = 50; // Number of trianges in #declare Nv = 50; // each earth direction. #declare Rad = 1; // Radius of the sphere. // This maps the spherical earth coordinates to 3D space: #macro MapUV(U,V) #end // The normals for the unscaled sphere are really simple to calculate: #macro Normal(P) #local Len=sqrt(P.x*P.x+P.y*P.y+P.z*P.z); #end // The complete object; many thanks to the new POVRAY language features, // which make this possible (even if it takes longer than hard coded // scene constructions in the C-language): #macro MyObject() #local Iu=0; #while (Iu0) smooth_triangle { PU1V1,NU1V1, PU2V1,NU2V1, PU1V2,NU1V2 } #end // Special net at the south pole (Iu=Nu-1): #if (Iu angle 40 look_at <0,0,0> } light_source { <-10,10,-10> color White } light_source { <10,10,-10> color White } background { color <0.0,0.5,0.5> } // Building the test object: #if (Triangle) union { MyObject() texture { T_Gold_1D } #if (Scaled) scale <1,0.3,1> #end } #else sphere { <0,0,0>,1 texture { T_Gold_1D } #if (Scaled) scale <1,0.3,1> #end } #end