POV-Ray : Newsgroups : povray.windows : This Scrip is not working on POV 3.1 ... BUG ? Server Time
28 Jul 2024 18:24:49 EDT (-0400)
  This Scrip is not working on POV 3.1 ... BUG ? (Message 1 to 4 of 4)  
From: LE COAT Francois
Subject: This Scrip is not working on POV 3.1 ... BUG ?
Date: 9 Jul 1998 10:45:30
Message: <35A4CBC2.2E4D4239@ief.u-psud.fr>
Hello everybody,

I just downloaded the 3.1 version of POV for Windows 95, and I am
testing a few scripts of mine. The first thing that I noticed is
that you must put a ';' when #declaring a float. Then it goes with
no warning. But this script that draws a star is not working well.
Only part of the vertex are drawn. I'm wondering if it's a bug of
the 3.1 version ... The initial 3.02 script that is available on 
my home page at :
http://www.ief.u-psud.fr/~lecoat/vrml/etoile.pov
is not working even if you add the #version 3.0;
directive ... Thanks to help me ...

-- Francois LE COAT
Author of Eureka 2.12 (2D Graph Describer 3D Modeller)
WEB : http://www.ief.u-psud.fr/~lecoat
E-mail : mailto:lec### [at] iefu-psudfr
________________________________________________________________________#declare
Green_Phong = texture {
        pigment { color rgb <0.0,0.5,0.5> }
        normal { ripples 0.5 scale 0.1 }
        finish { phong 1.0 phong_size 5.0 }
}

#declare xmin  = 0;
#declare xmax  = 2*pi;
#declare ymin  = 0;
#declare ymax  = pi;
#declare xiter = 11;
#declare yiter = 5;
#declare ix    = (xmax-xmin)/(xiter-1.0);
#declare iy    = (ymax-ymin)/(yiter-1.0);
#declare deltax = (xmax-xmin)/((xiter-1.0)*4.0);
#declare deltay = (ymax-ymin)/((yiter-1.0)*4.0);
#macro point (xx,yy)
    #local ro=max((1-3*sin(2*yy)*sin(5*xx+pi/2)),0);
    #declare zn=-ro*sin(yy)*cos(xx);
    #declare xn=ro*sin(yy)*sin(xx);
    #declare yn=ro*cos(yy);
    #declare xx=xx+deltax;
    #local ro=max((1-3*sin(2*yy)*sin(5*xx+pi/2)),0);
    #local zp=-ro*sin(yy)*cos(xx);
    #local xp=ro*sin(yy)*sin(xx);
    #local yp=ro*cos(yy);
    #declare xx=xx-deltax;
    #declare yy=yy+deltay;
    #local ro=max((1-3*sin(2*yy)*sin(5*xx+pi/2)),0);
    #local zq=-ro*sin(yy)*cos(xx);
    #local xq=ro*sin(yy)*sin(xx);
    #local yq=ro*cos(yy);
    #declare yy=yy-deltay;
    #declare vn=vcross(<xp-xn,yp-yn,zp-zn>,<xq-xn,yq-yn,zq-zn>);
#end
#declare etoile = mesh {
  #declare xx = xmin;
  #while (xx<xmax)                        //outer loop
    #declare yy = ymin;
    #while (yy<ymax)                      //inner loop
//POINTS
    point(xx,yy)
    #declare n1=vnormalize(vn);
    #declare p1=<xn,yn,zn>;

    #declare yy=yy+iy;
    point(xx,yy)
    #declare n2=vnormalize(vn);
    #declare p2=<xn,yn,zn>;

    #declare xx=xx+ix;
    point(xx,yy)
    #declare n3=vnormalize(vn);
    #declare p3=<xn,yn,zn>;

    #declare yy=yy-iy;
    point(xx,yy)
    #declare n4=vnormalize(vn);
    #declare p4=<xn,yn,zn>;

    #declare xx=xx-ix;
#if(!(p1.x=p2.x&p1.y=p2.y&p1.z=p2.z)|(p2.x=p3.x&p2.y=p3.y&p2.z=p3.z)|(p1.x=p3.x&p1.y=p3.y&p1.z=p3.z))
        smooth_triangle {
          p1,n1,
          p2,n2,
          p3,n3
         }

#end
#if(!(p1.x=p3.x&p1.y=p3.y&p1.z=p3.z)|(p3.x=p4.x&p3.y=p4.y&p3.z=p4.z)|(p1.x=p4.x&p1.y=p4.y&p1.z=p4.z))
        smooth_triangle{
          p1,n1,
          p3,n3,
          p4,n4
         }
#end

      #declare yy = yy+iy;
   #end                 //inner loop
   #declare xx = xx+ix;
 #end                   //outer loop
 scale 1/5
}

object {
 etoile
 no_shadow
 texture { Green_Phong }
 }

//Lights, camera, action
camera
{ location  < 1, 1.25, -1>
  direction  1*z
  look_at   < 0, 0, 0>
}

light_source { < 0, 1.25, -1> color rgb 1 }
light_source { < 1, 1.25, -1> color rgb 1 }

object { box{-2,2 inverse} pigment{color rgb 0.8} }
_______________________________________________________________________


Post a reply to this message

From: F VERBAAS
Subject: Re: This Scrip is not working on POV 3.1 ... BUG ?
Date: 12 Jul 1998 13:14:26
Message: <35a8e0e2.0@news.povray.org>
Could it be that it does not like the lines arrowed below? You are fiddling
with variables used to call your macro, declared outside the macro's scope.

Better try giving XX and YY a different name within the macro. They are
local variables, and you avoid a lot of confusion by naming them
differently.

I am not certain whether a macro is called by value or by reference. Calling
by value would mean that any changes to the value of the local variables
will not be found in the calling body.

Frans

.......
some code
.....
>#macro point (xx,yy)
>    #local ro=max((1-3*sin(2*yy)*sin(5*xx+pi/2)),0);
>    #declare zn=-ro*sin(yy)*cos(xx);
>    #declare xn=ro*sin(yy)*sin(xx);
>    #declare yn=ro*cos(yy);
====>    #declare xx=xx+deltax;   <============ this may be ambiguous !!!
>    #local ro=max((1-3*sin(2*yy)*sin(5*xx+pi/2)),0);
>    #local zp=-ro*sin(yy)*cos(xx);
>    #local xp=ro*sin(yy)*sin(xx);
>    #local yp=ro*cos(yy);
====>    #declare xx=xx-deltax;  <============ So for this !!
====>    #declare yy=yy+deltay; <============ and this !!
>    #local ro=max((1-3*sin(2*yy)*sin(5*xx+pi/2)),0);
>    #local zq=-ro*sin(yy)*cos(xx);
>    #local xq=ro*sin(yy)*sin(xx);
>    #local yq=ro*cos(yy);
=====>    #declare yy=yy-deltay; <============ another
>    #declare vn=vcross(<xp-xn,yp-yn,zp-zn>,<xq-xn,yq-yn,zq-zn>);
>#end                                           // end of macro

>#declare etoile = mesh {
>  #declare xx = xmin;               <================
>  #while (xx<xmax)                        //outer loop
>    #declare yy = ymin;
>    #while (yy<ymax)                      //inner loop
>//POINTS
>    point(xx,yy)                          <================
______________________________________________________________________


Post a reply to this message

From: LE COAT Francois
Subject: Re: This Scrip is not working on POV 3.1 ... BUG ?
Date: 13 Jul 1998 06:44:24
Message: <35A9D942.D8414F58@ief.u-psud.fr>
Hello Frans,

F.VERBAAS wrote:
> 
> Could it be that it does not like the lines arrowed below? You are fiddling
> with variables used to call your macro, declared outside the macro's scope.
> 
> Better try giving XX and YY a different name within the macro. They are
> local variables, and you avoid a lot of confusion by naming them
> differently.
> 
> I am not certain whether a macro is called by value or by reference. Calling
> by value would mean that any changes to the value of the local variables
> will not be found in the calling body.
> 

Right, but if you tranform the scrip with different variables name,
it does the same thing. And be carefull (interesting experience) if
you miss to put the     #declare vv=vv-deltay;    (line 33) in the
macro, it
is wrong ! It means that variables are passed with address and that
yy (in the body) <=> vv (in the macro). So there absolutely no
ambiguity on the names. Also, #declare variables in the body must be
transmit
in arguments to the macro, else they are undefined. #declare in the
body are undefined in the macro. But #declare in the macro define
variable in the body. That's why there is a #local directive.
It seems that argument must be modified using #declare rather
then #local. So, the following scrip is as correct as the
previous one. But I think that POV 3.1 is rendering wrong
in that case ... It produces the same image as :
http://www.ief.u-psud.fr/~lecoat/vrml/etoile.pov
with #version 3.0; directive ...

Thanks for replying ...
Bye for now,

-- Francois LE COAT
Author of Eureka 2.12 (2D Graph Describer 3D Modeller)
WEB : http://www.ief.u-psud.fr/~lecoat
E-mail : mailto:lec### [at] iefu-psudfr
________________________________________________________________________
#declare Green_Phong = texture {
	pigment { color rgb <0.0,0.5,0.5> }
	normal { ripples 0.5 scale 0.1 }
	finish { phong 1.0 phong_size 5.0 }
}

#declare xmin  = 0;
#declare xmax  = 2*pi;
#declare ymin  = 0;
#declare ymax  = pi;
#declare xiter = 11;
#declare yiter = 5;
#declare ix    = (xmax-xmin)/(xiter-1.0);
#declare iy    = (ymax-ymin)/(yiter-1.0);
#declare deltax = (xmax-xmin)/((xiter-1.0)*4.0);
#declare deltay = (ymax-ymin)/((yiter-1.0)*4.0);
#macro point(uu,vv)
    #local ro=max((1-3*sin(2*vv)*sin(5*uu+pi/2)),0);
    #declare zn=-ro*sin(vv)*cos(uu);
    #declare xn=ro*sin(vv)*sin(uu);
    #declare yn=ro*cos(vv);
    #declare uu=uu+deltax;
    #local ro=max((1-3*sin(2*vv)*sin(5*uu+pi/2)),0);
    #local zp=-ro*sin(vv)*cos(uu);
    #local xp=ro*sin(vv)*sin(uu);
    #local yp=ro*cos(vv);
    #declare uu=uu-deltax;
    #declare vv=vv+deltay;
    #local ro=max((1-3*sin(2*vv)*sin(5*uu+pi/2)),0);
    #local zq=-ro*sin(vv)*cos(uu);
    #local xq=ro*sin(vv)*sin(uu);
    #local yq=ro*cos(vv);
    #declare vv=vv-deltay;
    #declare vn=vcross(<xp-xn,yp-yn,zp-zn>,<xq-xn,yq-yn,zq-zn>);
#end
#declare etoile = mesh {
  #declare xx = xmin;
  #while (xx<xmax)                        //outer loop
    #declare yy = ymin;
    #while (yy<ymax)                      //inner loop
//POINTS
    point(xx,yy)
    #declare n1=vnormalize(vn);
    #declare p1=<xn,yn,zn>;

    #declare yy=yy+iy;
    point(xx,yy)
    #declare n2=vnormalize(vn);
    #declare p2=<xn,yn,zn>;

    #declare xx=xx+ix;
    point(xx,yy)
    #declare n3=vnormalize(vn);
    #declare p3=<xn,yn,zn>;

    #declare yy=yy-iy;
    point(xx,yy)
    #declare n4=vnormalize(vn);
    #declare p4=<xn,yn,zn>;

    #declare xx=xx-ix;
#if(!(p1.x=p2.x&p1.y=p2.y&p1.z=p2.z)|(p2.x=p3.x&p2.y=p3.y&p2.z=p3.z)|(p1.x=p3.x&p1.y=p3.y&p1.z=p3.z))
        smooth_triangle {
          p1,n1,
          p2,n2,
          p3,n3
         }

#end
#if(!(p1.x=p3.x&p1.y=p3.y&p1.z=p3.z)|(p3.x=p4.x&p3.y=p4.y&p3.z=p4.z)|(p1.x=p4.x&p1.y=p4.y&p1.z=p4.z))
        smooth_triangle{
          p1,n1,
          p3,n3,
          p4,n4
         }
#end

      #declare yy = yy+iy;
   #end                 //inner loop
   #declare xx = xx+ix;
 #end                   //outer loop
 scale 1/5
}

object {
 etoile
 no_shadow
 texture { Green_Phong }
 }

//Lights, camera, action
camera
{ location  < 1, 1.25, -1>
  direction  1*z
  look_at   < 0, 0, 0>
}

light_source { < 0, 1.25, -1> color rgb 1 }
light_source { < 1, 1.25, -1> color rgb 1 }

object { box{-2,2 inverse} pigment{color rgb 0.8} }
________________________________________________________________________


Post a reply to this message

From: LE COAT Francois
Subject: Re: This Scrip is working on POV 3.1
Date: 13 Jul 1998 10:23:24
Message: <35AA0C99.D3A53891@ief.u-psud.fr>
Hello,

In Fact, working a little on this script, we can imagine that
maybe normals are too "sharp". When the normal is too sharp
POV 3.1 eliminates the considered vertex. So in this script
I eliminated the smooth_triangle, and replaced it by simple
triangle. Like this it works ...

-- Francois LE COAT

_______________________________________________________________________
#declare Gold_Phong = texture {
	pigment { color rgb <1.0,0.84,0.0> }
	normal { ripples 0.5 scale 0.1 }
	finish { phong 0.5 phong_size 1.0 }
}

#declare xmin  = 0;
#declare xmax  = 2*pi;
#declare ymin  = 0;
#declare ymax  = pi;
#declare xiter = 11;
#declare yiter = 5;
#declare ix    = (xmax-xmin)/(xiter-1.0);
#declare iy    = (ymax-ymin)/(yiter-1.0);
#macro point(uu,vv)
    #local ro=max((1-3*sin(2*vv)*sin(5*uu+pi/2)),0);
    #declare zn=-ro*sin(vv)*cos(uu);
    #declare xn=ro*sin(vv)*sin(uu);
    #declare yn=ro*cos(vv);
#end
#declare etoile = mesh {
  #declare xx = xmin;
  #while (xx<xmax)                        //outer loop
    #declare yy = ymin;
    #while (yy<ymax)                      //inner loop
//POINTS
    point(xx,yy)
    #declare p1=<xn,yn,zn>;

    #declare yy=yy+iy;
    point(xx,yy)
    #declare p2=<xn,yn,zn>;

    #declare xx=xx+ix;
    point(xx,yy)
    #declare p3=<xn,yn,zn>;

    #declare yy=yy-iy;
    point(xx,yy)
    #declare p4=<xn,yn,zn>;

    #declare xx=xx-ix;
#if(!(p1.x=p2.x&p1.y=p2.y&p1.z=p2.z)|(p2.x=p3.x&p2.y=p3.y&p2.z=p3.z)|(p1.x=p3.x&p1.y=p3.y&p1.z=p3.z))
        triangle { p1, p2, p3 }
#end

#if(!(p1.x=p3.x&p1.y=p3.y&p1.z=p3.z)|(p3.x=p4.x&p3.y=p4.y&p3.z=p4.z)|(p1.x=p4.x&p1.y=p4.y&p1.z=p4.z))
        triangle { p1, p3, p4 }
#end

      #declare yy = yy+iy;
   #end                 //inner loop
   #declare xx = xx+ix;
 #end                   //outer loop
 scale 1/5
}

object {
 etoile
 texture { Gold_Phong }
 }

//Lights, camera, action
camera
{ location  < 1, 1.25, -1>
  direction  1*z
  look_at   < 0, 0, 0>
}

light_source { < 0, 1.25, -1> color rgb 1 }
light_source { < 1, 1.25, -1> color rgb 1 }

object { box{-2,2 inverse} pigment{color rgb 0.8} }
_______________________________________________________________________


Post a reply to this message

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