POV-Ray : Newsgroups : povray.unofficial.patches : Bug in pigment object (Chris Huff's patch) : Bug in pigment object (Chris Huff's patch) Server Time
2 Nov 2024 11:26:43 EDT (-0400)
  Bug in pigment object (Chris Huff's patch)  
From: smellenbergh
Date: 7 Dec 1999 14:26:17
Message: <1e2gl0e.1hrykd4wgajkkN%smellenbergh@skynet.be>
The pigment object causes a crash when the object is a CSG construction.

Below are two scenes that allmost always crashes with type 1, 2 or 11
error (Macintosh)

Anyone having the same problems? Any fixes?

//First scene
camera {
    location <0.0, 0.0, -6>
    angle 60
    look_at <0.0, 0.0, 0.0>
}

light_source {
    <0.0, 20, -100>
    rgb <1.0, 1.0, 1.0>
}


#declare TexObj =
        // Point connector macro
    #macro P_C_P ( Center, Radius, R, G, B, F, T, Center2,  Radius2,
R2, G2, B2, F2, T2)
        #local dx = Center2.x - Center.x ;      #if (dx=0) #declare dx=
0.000001; #end
        #local dy = Center2.y - Center.y ;
        #local dz = Center2.z - Center.z ;
        #local len = sqrt (dx*dx+dy*dy+dz*dz);
        #local xylen = sqrt (dx*dx+dy*dy);
        #local D = acos( (Radius-Radius2)/len);
            < cos(D)*Radius, 0, 0>, sin(D)*Radius ,
            < len + (cos(D)*Radius2), 0, 0>, sin(D)*Radius2
        texture {
            pigment {
                gradient x
                color_map { [ 0.0 1.0 rgbft < R, G, B, F, T > color
rgbft < R2, G2, B2, F2, T2 > ] }
                scale <( len + (cos(D)*Radius2))-(cos(D)*Radius), 1, 1>
                translate < cos(D)*Radius, 0, 0>
            }
        }
        rotate <0,  degrees(-atan2(dz, xylen)), degrees(atan2 (dy, dx))>
        translate <Center.x, Center.y, Center.z>
    #end

    #declare C = 0;
    #declare Copies = 500;
    
    #declare S1 = -1;   
            union {
        #while ( C < Copies)
            #declare Center = <0, 0, 0>;   #declare Radius = 1.0;
            #declare Center2 = <0, 0, 0>;   #declare Radius2 = 1.0;
            sphere {

                #if (((C/(250)) - floor (C/(250))) = 0)     #declare
SubC1 = 0;  #declare S1 = S1 * -1;#end  //reverse
                #declare Radius = Radius * (0.01 #if (S1<0) + ((0.1
-(0.01))/(250) * (250)) #end + (((SubC1 * (0.1 -(0.01))/(250 -1))) * S1
));
                #if (((C +1)/(250) - floor ((C +1)/(250))) = 0)
                    #declare Radius2 = Radius;
                #else
                    #declare Radius2 = Radius2 * (0.01 #if (S1<0) +
((0.1 -(0.01))/(250) *250) #end + ((((SubC1+1) * (0.1 -(0.01))/(250
-1))) * S1));
                #end
                #declare Tx = (1);
                #declare Center = Center + <Tx, 0, 0>;
                #declare Tx2 = (1);
                #declare Center2 = Center2 + <Tx2, 0, 0>;
                #declare Ty = (-5 + (C * (5 - (-5))/(Copies -1)));
                #declare Center = Center + <0, Ty, 0>;
                #declare Ty2 = (-5 + ((C+1) * (5 -(-5))/(Copies -1)));
                #declare Center2 = Center2 + <0, Ty2, 0>;
                #declare Roty = (0 + (C * (360*10 - (0))/(Copies -1)));
                #declare Center = vaxis_rotate (Center, y, Roty);
                #declare Roty2 = (0 + ((C+1) * (360*10 -(0))/(Copies
-1)));
                #declare Center2 = vaxis_rotate (Center2, y, Roty2);
                Center, Radius
                #declare R = (0.000000 + (C * (0.694820
-(0.000000))/(Copies -1)));
                #declare G = (0.000000 + (C * (0.694820
-(0.000000))/(Copies -1)));
                #declare B = (1.000000 + (C * (0.152590
-(1.000000))/(Copies -1)));
                #declare F = (0 + (C * (0 -(0))/(Copies -1)));
                #declare T = (0 + (C * (0 -(0))/(Copies -1)));
                texture { pigment {     rgbft <R, G, B, F, T> } }
                #declare R2 = (0.000000 + ((C+1) * (0.694820
-(0.000000))/(Copies -1)));
                #declare G2 = (0.000000 + ((C+1) * (0.694820
-(0.000000))/(Copies -1)));
                #declare B2 = (1.000000 + ((C+1) * (0.152590
-(1.000000))/(Copies -1)));
                #declare F2 = (0 + ((C+1) * (0 -(0))/(Copies -1)));
                #declare T2 = (0 + ((C+1) * (0 -(0))/(Copies -1)));
            }
            #if ((C+1) < Copies)
                cone {P_C_P ( Center, Radius, R, G, B, F, T, Center2,
Radius2,  R2, G2, B2, F2, T2 )              }
                #declare SubC1 = SubC1+1;
            #end  //#if ((C+1) < Copies)
            #declare C = C +1;
        #end  //while (C < Copies)
    } //union
    
    
cylinder {
    <0, -5, 0>, <0, 5, 0>, 1
    pigment { object { TexObj color rgb <1, 0, 0> color <0, 1, 0> }}
}

//second scene

camera {
    location <0.0, 0.0, -6>
    angle 60
    look_at <0.0, 0.0, 0.0>
}

light_source {
    <0.0, 20, -100>
    rgb <1.0, 1.0, 1.0>
}

#declare StarObj =
union {
        #declare C = 0;
    #declare Copies =20;
            #while ( C < Copies)
        prism {
            linear_spline
            linear_sweep
            0,  //Base height
            2.1,    //Top height
            13,
            <0.25419, 0.00000>,
            <0.86603, 0.50000>,
            <0.14121, 0.24459>,
            <-0.00000, 1.00000>,
            <-0.14121, 0.24459>,
            <-0.86603, 0.50000>,
            <-0.28243, -0.00000>,
            <-0.86603, -0.50000>,
            <-0.14121, -0.24459>,
            <0.00000, -1.00000>,
            <0.14121, -0.24459>,
            <0.86603, -0.50000>,
            <0.25419, 0.00000>
            sturm
            scale <0.3, 1, 0.3>
            rotate x * (-89.5)
            rotate y * (0 + (C * (360)/(Copies -1)))
        } //object
        #declare C = C +1;
    #end  //while (C < Copies)
    }
    

sphere {
    <0.0, 0.0, 0.0>, 2
    pigment { object { StarObj color rgb <1, 0, 0> color <0, 1, 0> }}
}

-- 
e-mail:sme### [at] skynetbe

http://users.skynet.be/smellenbergh


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.