POV-Ray : Newsgroups : povray.beta-test : error in SQRT Server Time
5 Nov 2024 07:15:42 EST (-0500)
  error in SQRT (Message 1 to 7 of 7)  
From: JRG
Subject: error in SQRT
Date: 6 Sep 2001 09:20:25
Message: <3b977819@news.povray.org>
This scene works perfectly in MegaPov. It's the *lightflow thingy* made by
Warp.

Parse Error: Expected 'operand', sqr found instead.

isosurface
{ function
/* here error occurs---> */  {
sqrt(sqr(sqrt(sqr(x)+sqr(z))-1.5)+sqr(y))-(.3+.2*sin(8*atan2(x,z))) }
  contained_by { box { -<2,.5,2.1>,<2,.7,2> } }
   max_gradient 2.41 accuracy 10^-3
  translate .5*y
  pigment {rgb 1}
scale .7}

camera { location <-2,3,-3> look_at 0 }
light_source
{ <4,5,-5> rgb 3/2
}
plane
{ y,0
  pigment { rgb 1 }
}


Post a reply to this message

From: Warp
Subject: Re: error in SQRT
Date: 6 Sep 2001 09:24:02
Message: <3b9778f1@news.povray.org>
JRG <jrg### [at] hotmailcom> wrote:
: Parse Error: Expected 'operand', sqr found instead.

  The sqr() function doesn't exist. Use ^2 instead (it shouldn't be any
slower).

-- 
#macro N(D,I)#if(I<6)cylinder{M()#local D[I]=div(D[I],104);M().5,2pigment{
rgb M()}}N(D,(D[I]>99?I:I+1))#end#end#macro M()<mod(D[I],13)-6,mod(div(D[I
],13),8)-3,10>#end blob{N(array[6]{11117333955,
7382340,3358,3900569407,970,4254934330},0)}//                     - Warp -


Post a reply to this message

From: Ron Parker
Subject: Re: error in SQRT
Date: 6 Sep 2001 09:24:31
Message: <slrn9peu8h.voj.ron.parker@fwi.com>
On Thu, 6 Sep 2001 15:20:11 +0200, JRG wrote:
>This scene works perfectly in MegaPov. It's the *lightflow thingy* made by
>Warp.
>
>Parse Error: Expected 'operand', sqr found instead.

POV 3.5 is not MegaPOV.  POV 3.5 does not have a "sqr" function.

-- 
#local R=<7084844682857967,0787982,826975826580>;#macro L(P)concat(#while(P)chr(
mod(P,100)),#local P=P/100;#end"")#end background{rgb 1}text{ttf L(R.x)L(R.y)0,0
translate<-.8,0,-1>}text{ttf L(R.x)L(R.z)0,0translate<-1.6,-.75,-1>}sphere{z/9e3
4/26/2001finish{reflection 1}}//ron.parker@povray.org My opinions, nobody else's


Post a reply to this message

From: JRG
Subject: Re: error in SQRT
Date: 6 Sep 2001 09:27:04
Message: <3b9779a8@news.povray.org>
But I tried to define a sqr macro as follows:

#macro sqr(A)
A*A
#end

and I got

Parse Error: Expected 'undeclared identifier', sqr found instead.



"Ron Parker" <ron### [at] povrayorg> ha scritto nel messaggio
news:slr### [at] fwicom...
> On Thu, 6 Sep 2001 15:20:11 +0200, JRG wrote:
> >This scene works perfectly in MegaPov. It's the *lightflow thingy* made
by
> >Warp.
> >
> >Parse Error: Expected 'operand', sqr found instead.
>
> POV 3.5 is not MegaPOV.  POV 3.5 does not have a "sqr" function.
>
> --
> #local R=<7084844682857967,0787982,826975826580>;#macro
L(P)concat(#while(P)chr(
> mod(P,100)),#local P=P/100;#end"")#end background{rgb 1}text{ttf
L(R.x)L(R.y)0,0
> translate<-.8,0,-1>}text{ttf
L(R.x)L(R.z)0,0translate<-1.6,-.75,-1>}sphere{z/9e3
> 4/26/2001finish{reflection 1}}//ron.parker@povray.org My opinions, nobody
else's


Post a reply to this message

From: Ron Parker
Subject: Re: error in SQRT
Date: 6 Sep 2001 09:31:15
Message: <slrn9peul5.voj.ron.parker@fwi.com>
On Thu, 6 Sep 2001 15:26:50 +0200, JRG wrote:
>But I tried to define a sqr macro as follows:
>
>#macro sqr(A)
>A*A
>#end
>
>and I got
>
>Parse Error: Expected 'undeclared identifier', sqr found instead.

What if you define it as a function instead, since that's what you really
want?

-- 
#local R=rgb 99;#local P=R-R;#local F=pigment{gradient x}box{0,1pigment{gradient
y pigment_map{[.5F pigment_map{[.3R][.3F color_map{[.15red 99][.15P]}rotate z*45
translate x]}]#local H=pigment{gradient y color_map{[.5P][.5R]}scale 1/3}[.5F
pigment_map{[.3R][.3H][.7H][.7R]}]}}}camera{location.5-3*z}//only my opinions


Post a reply to this message

From: Warp
Subject: Re: error in SQRT
Date: 6 Sep 2001 11:11:37
Message: <3b979229@news.povray.org>
Ron Parker <ron### [at] povrayorg> wrote:
: What if you define it as a function instead, since that's what you really
: want?

  Actually this has been done already: f_sqr() in math.inc.

-- 
#macro N(D,I)#if(I<6)cylinder{M()#local D[I]=div(D[I],104);M().5,2pigment{
rgb M()}}N(D,(D[I]>99?I:I+1))#end#end#macro M()<mod(D[I],13)-6,mod(div(D[I
],13),8)-3,10>#end blob{N(array[6]{11117333955,
7382340,3358,3900569407,970,4254934330},0)}//                     - Warp -


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: error in SQRT
Date: 6 Sep 2001 11:24:39
Message: <3b979537@news.povray.org>
In article <slr### [at] fwicom> , ron### [at] povrayorg (Ron
Parker) wrote:

>>But I tried to define a sqr macro as follows:
>>
>>#macro sqr(A)
>>A*A
>>#end
>>
>>and I got
>>
>>Parse Error: Expected 'undeclared identifier', sqr found instead.
>
> What if you define it as a function instead, since that's what you really
> want?

I would not recommend using a function for such a simple case.  It will work
for sure, but there is some overhead involved that (if used carelessly) can
slow down rendering of isosurfaces a lot.  The built-in operators should be
used whenever possible as they offer by far the best performance.


    Thorsten


____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trfde

Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

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