POV-Ray : Newsgroups : povray.newusers : While in while: help me, please! Server Time
23 Nov 2024 12:00:00 EST (-0500)
  While in while: help me, please! (Message 1 to 6 of 6)  
From: LanuHum
Subject: While in while: help me, please!
Date: 19 Jan 2014 10:50:00
Message: <web.52dbf34f4068fb557a3e03fe0@news.povray.org>
Hi!
Sorry!
Again it is impossible to me :(
It is necessary to create object from the array

File 'HairSystem.inc' line 54: Parse error:
Expected 'numeric expression', array identifier found instead
Fatal error in parser: Cannot parse input
Render failed

#declare ArrayHairSystem = array[4] {
spline { cubic_spline
0/9 <1.104,-0.535,-0.7421>
1/9 <1.358,-0.4768,-0.8438>
2/9 <1.626,-0.3345,-0.922>
3/9 <1.939,-0.1466,-0.9378>
4/9 <2.328,0.04195,-0.8999>
5/9 <2.732,0.1853,-0.8488>
6/9 <3.079,0.2744,-0.8224>
7/9 <3.371,0.3472,-0.8292>
8/9 <3.616,0.4306,-0.8473>
},
spline { cubic_spline
0/9 <1.281,-0.6221,-0.5943>
1/9 <1.531,-0.6057,-0.8389>
2/9 <1.761,-0.4055,-1.027>
3/9 <2.022,-0.1217,-1.065>
4/9 <2.371,0.1307,-0.9738>
5/9 <2.757,0.2744,-0.8509>
6/9 <3.1,0.3207,-0.7875>
7/9 <3.387,0.3535,-0.8038>
8/9 <3.616,0.4306,-0.8473>
},
spline { cubic_spline
0/9 <1.091,-0.6223,-0.6592>
1/9 <1.357,-0.5827,-0.841>
2/9 <1.618,-0.4031,-0.9808>
3/9 <1.915,-0.1566,-1.009>
4/9 <2.296,0.07255,-0.9414>
5/9 <2.704,0.2209,-0.85>
6/9 <3.062,0.2908,-0.8028>
7/9 <3.366,0.346,-0.815>
8/9 <3.616,0.4306,-0.8473>
},
spline { cubic_spline
0/9 <1.107,-0.5015,-0.7747>
1/9 <1.356,-0.4359,-0.8449>
2/9 <1.627,-0.3081,-0.8988>
3/9 <1.946,-0.1432,-0.9097>
4/9 <2.339,0.02948,-0.8836>
5/9 <2.742,0.171,-0.8484>
6/9 <3.084,0.2678,-0.8302>
7/9 <3.372,0.3476,-0.8348>
8/9 <3.616,0.4306,-0.8473>
},
}
#declare HairSegment =
sphere {0,0.1 translate z*0.125}

#declare HairStep = 1;
#declare Hair =
union {
    #declare I = 0;
    #while (I < ArrayHairSystem)
        union {
            #declare ctr = 0;
            #while (ctr < 1)
                object { HairSegment texture{pigment{rgb 1}}rotate z*0
                        translate ArrayHairSystem[I] (ctr)}
            #declare ctr = ctr + 0.00025;
            #end
#local I = I + HairStep
#end
}}

Thanks!


Post a reply to this message

From: Jeff Reifel
Subject: Re: While in while: help me, please!
Date: 19 Jan 2014 12:05:00
Message: <web.52dc04c19cd0892411fab0250@news.povray.org>
"LanuHum" <Lan### [at] yandexru> wrote:
> Hi!
> Sorry!
> Again it is impossible to me :(
> It is necessary to create object from the array
>
> File 'HairSystem.inc' line 54: Parse error:
> Expected 'numeric expression', array identifier found instead
> Fatal error in parser: Cannot parse input
> Render failed
>
> #declare ArrayHairSystem = array[4] {
> spline { cubic_spline
> 0/9 <1.104,-0.535,-0.7421>
> 1/9 <1.358,-0.4768,-0.8438>
> 2/9 <1.626,-0.3345,-0.922>
> 3/9 <1.939,-0.1466,-0.9378>
> 4/9 <2.328,0.04195,-0.8999>
> 5/9 <2.732,0.1853,-0.8488>
> 6/9 <3.079,0.2744,-0.8224>
> 7/9 <3.371,0.3472,-0.8292>
> 8/9 <3.616,0.4306,-0.8473>
> },
> spline { cubic_spline
> 0/9 <1.281,-0.6221,-0.5943>
> 1/9 <1.531,-0.6057,-0.8389>
> 2/9 <1.761,-0.4055,-1.027>
> 3/9 <2.022,-0.1217,-1.065>
> 4/9 <2.371,0.1307,-0.9738>
> 5/9 <2.757,0.2744,-0.8509>
> 6/9 <3.1,0.3207,-0.7875>
> 7/9 <3.387,0.3535,-0.8038>
> 8/9 <3.616,0.4306,-0.8473>
> },
> spline { cubic_spline
> 0/9 <1.091,-0.6223,-0.6592>
> 1/9 <1.357,-0.5827,-0.841>
> 2/9 <1.618,-0.4031,-0.9808>
> 3/9 <1.915,-0.1566,-1.009>
> 4/9 <2.296,0.07255,-0.9414>
> 5/9 <2.704,0.2209,-0.85>
> 6/9 <3.062,0.2908,-0.8028>
> 7/9 <3.366,0.346,-0.815>
> 8/9 <3.616,0.4306,-0.8473>
> },
> spline { cubic_spline
> 0/9 <1.107,-0.5015,-0.7747>
> 1/9 <1.356,-0.4359,-0.8449>
> 2/9 <1.627,-0.3081,-0.8988>
> 3/9 <1.946,-0.1432,-0.9097>
> 4/9 <2.339,0.02948,-0.8836>
> 5/9 <2.742,0.171,-0.8484>
> 6/9 <3.084,0.2678,-0.8302>
> 7/9 <3.372,0.3476,-0.8348>
> 8/9 <3.616,0.4306,-0.8473>
> },
> }
> #declare HairSegment =
> sphere {0,0.1 translate z*0.125}
>
> #declare HairStep = 1;
> #declare Hair =
> union {
>     #declare I = 0;
>     #while (I < ArrayHairSystem)
>         union {
>             #declare ctr = 0;
>             #while (ctr < 1)
>                 object { HairSegment texture{pigment{rgb 1}}rotate z*0
>                         translate ArrayHairSystem[I] (ctr)}
>             #declare ctr = ctr + 0.00025;
>             #end
> #local I = I + HairStep
> #end
> }}
>
> Thanks!

ArrayHairSystem is your array not the size of your array. In your while loop you
need to step through your array one spline at a time.
 Try This
#declare ArrayHairSystem = array[4] {
spline { cubic_spline
0/9 <1.104,-0.535,-0.7421>
1/9 <1.358,-0.4768,-0.8438>
2/9 <1.626,-0.3345,-0.922>
3/9 <1.939,-0.1466,-0.9378>
4/9 <2.328,0.04195,-0.8999>
5/9 <2.732,0.1853,-0.8488>
6/9 <3.079,0.2744,-0.8224>
7/9 <3.371,0.3472,-0.8292>
8/9 <3.616,0.4306,-0.8473>
},
spline { cubic_spline
0/9 <1.281,-0.6221,-0.5943>
1/9 <1.531,-0.6057,-0.8389>
2/9 <1.761,-0.4055,-1.027>
3/9 <2.022,-0.1217,-1.065>
4/9 <2.371,0.1307,-0.9738>
5/9 <2.757,0.2744,-0.8509>
6/9 <3.1,0.3207,-0.7875>
7/9 <3.387,0.3535,-0.8038>
8/9 <3.616,0.4306,-0.8473>
},
spline { cubic_spline
0/9 <1.091,-0.6223,-0.6592>
1/9 <1.357,-0.5827,-0.841>
2/9 <1.618,-0.4031,-0.9808>
3/9 <1.915,-0.1566,-1.009>
4/9 <2.296,0.07255,-0.9414>
5/9 <2.704,0.2209,-0.85>
6/9 <3.062,0.2908,-0.8028>
7/9 <3.366,0.346,-0.815>
8/9 <3.616,0.4306,-0.8473>
},
spline { cubic_spline
0/9 <1.107,-0.5015,-0.7747>
1/9 <1.356,-0.4359,-0.8449>
2/9 <1.627,-0.3081,-0.8988>
3/9 <1.946,-0.1432,-0.9097>
4/9 <2.339,0.02948,-0.8836>
5/9 <2.742,0.171,-0.8484>
6/9 <3.084,0.2678,-0.8302>
7/9 <3.372,0.3476,-0.8348>
8/9 <3.616,0.4306,-0.8473>
},
}
#declare HairSegment =
sphere {0,0.01 }

#declare HairStep = 1;
#declare Hair =
union {
    #declare I = 0;
    #while (I < 4) //!!!!!!!!/4 splines in your array!!!!!!!!!!
        union {
            #declare ctr = 0;
            #while (ctr < 1)
                object { HairSegment texture{pigment{rgb 1}}
                        translate ArrayHairSystem[I](ctr)}
            #declare ctr = ctr + 0.0025;
            #end }
#local I = I + HairStep ;
#end }
object{Hair}
camera{ location -z*2 look_at x*3}
light_source{-z*99 rgb 1}
background{rgb z}


Post a reply to this message

From: LanuHum
Subject: Re: While in while: help me, please!
Date: 19 Jan 2014 12:50:00
Message: <web.52dc0fca9cd089247a3e03fe0@news.povray.org>
"Jeff Reifel" <jef### [at] rocketmailcom> wrote:

> #declare HairSegment =
> sphere {0,0.01 }
>
> #declare HairStep = 1;
> #declare Hair =
> union {
>     #declare I = 0;
>     #while (I < 4) //!!!!!!!!/4 splines in your array!!!!!!!!!!
>         union {
>             #declare ctr = 0;
>             #while (ctr < 1)
>                 object { HairSegment texture{pigment{rgb 1}}
>                         translate ArrayHairSystem[I](ctr)}
>             #declare ctr = ctr + 0.0025;
>             #end }
> #local I = I + HairStep ;
> #end }


Thanks! Thank you!


Post a reply to this message

From: LanuHum
Subject: Re: While in while: help me, please!
Date: 21 Jan 2014 11:05:01
Message: <web.52de9a879cd089247a3e03fe0@news.povray.org>
"LanuHum" <Lan### [at] yandexru> wrote:
> "Jeff Reifel" <jef### [at] rocketmailcom> wrote:
>
> > #declare HairSegment =
> > sphere {0,0.01 }
> >
> > #declare HairStep = 1;
> > #declare Hair =
> > union {
> >     #declare I = 0;
> >     #while (I < 4) //!!!!!!!!/4 splines in your array!!!!!!!!!!
> >         union {
> >             #declare ctr = 0;
> >             #while (ctr < 1)
> >                 object { HairSegment texture{pigment{rgb 1}}
> >                         translate ArrayHairSystem[I](ctr)}
> >             #declare ctr = ctr + 0.0025;
> >             #end }
> > #local I = I + HairStep ;
> > #end }
>
>
> Thanks! Thank you!

Sorry!
Now I need to paint a hair.
1/3 lengths the black
1/3 lengths smooth transition to the white
1/3 lengths the white
That is, it is necessary to include conditions "if"

Help me, please, once again!
Thanks!


Post a reply to this message

From: Jeff Reifel
Subject: Re: While in while: help me, please!
Date: 21 Jan 2014 13:20:01
Message: <web.52deb9619cd0892411fab0250@news.povray.org>
"LanuHum" <Lan### [at] yandexru> wrote:
> "LanuHum" <Lan### [at] yandexru> wrote:
> > "Jeff Reifel" <jef### [at] rocketmailcom> wrote:
> >
> > > #declare HairSegment =
> > > sphere {0,0.01 }
> > >
> > > #declare HairStep = 1;
> > > #declare Hair =
> > > union {
> > >     #declare I = 0;
> > >     #while (I < 4) //!!!!!!!!/4 splines in your array!!!!!!!!!!
> > >         union {
> > >             #declare ctr = 0;
> > >             #while (ctr < 1)
> > >                 object { HairSegment texture{pigment{rgb 1}}
> > >                         translate ArrayHairSystem[I](ctr)}
> > >             #declare ctr = ctr + 0.0025;
> > >             #end }
> > > #local I = I + HairStep ;
> > > #end }
> >
> >
> > Thanks! Thank you!
>
> Sorry!
> Now I need to paint a hair.
> 1/3 lengths the black
> 1/3 lengths smooth transition to the white
> 1/3 lengths the white
> That is, it is necessary to include conditions "if"
>
> Help me, please, once again!
> Thanks!

Try something like this:
 pigment{rgb min(1,1.33-ctr*3.7)} finish{diffuse 1 }


Post a reply to this message

From: LanuHum
Subject: Re: While in while: help me, please!
Date: 22 Jan 2014 12:15:00
Message: <web.52dffbc29cd089247a3e03fe0@news.povray.org>
"Jeff Reifel" <jef### [at] rocketmailcom> wrote:
>
> Try something like this:
>  pigment{rgb min(1,1.33-ctr*3.7)} finish{diffuse 1 }

Thanks.
But, I solved the problem in such a way:

#declare TableLeg =
#declare ctr = 0;
#declare col = 0;
union {
 #while (ctr < 1)
  object { TableLegSegment texture{pigment{rgb col}}rotate z*0
   translate TableLegShape (ctr)
   }
  #declare ctr = ctr + 0.00025;
  #if (ctr > 0.5)
        #declare col = col + 0.0025;
        #end
  #if (ctr > 0.6)
        #declare col = 1;
        #end
 #end
 }
object {
     TableLeg
}


Post a reply to this message

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