POV-Ray : Newsgroups : povray.general : Bug - sgn() function Server Time
5 Aug 2024 16:15:09 EDT (-0400)
  Bug - sgn() function (Message 1 to 10 of 13)  
Goto Latest 10 Messages Next 3 Messages >>>
From: Demevec
Subject: Bug - sgn() function
Date: 8 Aug 2002 11:24:28
Message: <3d528d2c@news.povray.org>
I am using version 3.5 of POVray for Windows and hit a snag when I couldn't
get a built in function to work.

It was the sgn() function.  I got error messages that seemed to indicate
that it wasn't recognized as a function when it was parsed.  It also wasn't
recognized as a keyword when using POVray's built-in editor (for Windows)
which colors recognized keywords.

I used only a simple statement such as: "#declare Value1=sgn(-3);".

Could someone help me verify if this is a bug or maybe a workaround if it is
or etc.


Thanks

Demevec


Post a reply to this message

From: Rafal 'Raf256' Maj
Subject: Re: Bug - sgn() function
Date: 8 Aug 2002 11:34:52
Message: <Xns9264B239EA71raf256com@204.213.191.226>
"Demevec" <lik### [at] msncom> wrote in news:3d528d2c@news.povray.org

> I used only a simple statement such as: "#declare Value1=sgn(-3);".

looks like bug IMHO
 
> Could someone help me verify if this is a bug or maybe a workaround if
> it is or etc.

#macro Mysgn(a)
  #local r=0;
  #if (a) #local r=a/abs(a); #end
  r
#end

#declare a=Mysgn(-3);
#declare b=Mysgn(+3);
#declare c=Mysgn(0);

#debug concat( str(a,3,9),"  ",str(b,3,9),"  ",str(c,3,9),"\n")


-- 
#macro g(U,V)(.4*abs(sin(9*sqrt(pow(x-U,2)+pow(y-V,2))))*pow(1-min(1,(sqrt(
pow(x-U,2)+pow(y-V,2))*.3)),2)+.9)#end#macro p(c)#if(c>1)#local l=mod(c,100
);g(2*div(l,10)-8,2*mod(l,10)-8)*p(div(c,100))#else 1#end#end light_source{
y 2}sphere{z*20 9pigment{function{p(26252423)*p(36455644)*p(66656463)}}}//M


Post a reply to this message

From: Christoph Hormann
Subject: Re: Bug - sgn() function
Date: 8 Aug 2002 11:39:42
Message: <3D5290BB.DCEB439@gmx.de>
Demevec wrote:
> 
> [...]
> 
> I used only a simple statement such as: "#declare Value1=sgn(-3);".
> 
> Could someone help me verify if this is a bug or maybe a workaround if it is
> or etc.

You need to add

#include "math.inc"

before using the sgn() function.

Christoph

-- 
POV-Ray tutorials, IsoWood include,                 
TransSkin and more: http://www.tu-bs.de/~y0013390/  
Last updated 03 Aug. 2002 _____./\/^>_*_<^\/\.______


Post a reply to this message

From: Christopher James Huff
Subject: Re: Bug - sgn() function
Date: 8 Aug 2002 14:15:02
Message: <chrishuff-4EB27F.13050908082002@netplex.aussie.org>
In article <Xns### [at] 204213191226>,
 "Rafal 'Raf256' Maj" <raf### [at] raf256com> wrote:

> > I used only a simple statement such as: "#declare Value1=sgn(-3);".
> 
> looks like bug IMHO

Not a bug, just a user misunderstanding, see the answer by Christoph. It 
wasn't recognized as a function because it wasn't declared.

-- 
Christopher James Huff <chr### [at] maccom>
POV-Ray TAG e-mail: chr### [at] tagpovrayorg
TAG web site: http://tag.povray.org/


Post a reply to this message

From: Philippe Debar
Subject: Re: Bug - sgn() function
Date: 8 Aug 2002 17:02:25
Message: <3d52dc61$1@news.povray.org>
"Christoph Hormann" <chr### [at] gmxde> wrote in message
news:3D5### [at] gmxde...
>
>
> Demevec wrote:
> >
> > [...]
> >
> > I used only a simple statement such as: "#declare Value1=sgn(-3);".
> >
> > Could someone help me verify if this is a bug or maybe a workaround if
it is
> > or etc.
>
> You need to add
>
> #include "math.inc"
>
> before using the sgn() function.

I think we will see a good number of such question, as it's not very clear
in the doc if you get there by doing a search. Should it be added to the
VFAQ ?



Povingly,

Philippe


Post a reply to this message

From: Christoph Hormann
Subject: Re: Bug - sgn() function
Date: 8 Aug 2002 17:23:02
Message: <3D52E135.768AB19B@gmx.de>
Philippe Debar wrote:
> 
> I think we will see a good number of such question, as it's not very clear
> in the doc if you get there by doing a search. Should it be added to the
> VFAQ ?


is part of the math.inc description.  What's unclear about that?

Christoph

-- 
POV-Ray tutorials, IsoWood include,                 
TransSkin and more: http://www.tu-bs.de/~y0013390/  
Last updated 03 Aug. 2002 _____./\/^>_*_<^\/\.______


Post a reply to this message

From: Philippe Debar
Subject: Re: Bug - sgn() function
Date: 9 Aug 2002 04:08:30
Message: <3d53787e$1@news.povray.org>
Christoph Hormann wrote:
> Hmm, searching for 'sgn' finds "7.10.1  Float functions and macros" which
> is part of the math.inc description.  What's unclear about that?

That it is part of math.inc description. I find it far from obvious if 
you do not know by hearth the doc's numbering system. (At least on Win 
it is not obvious.)



Philippe


Post a reply to this message

From: Philippe Lhoste
Subject: Re: Bug - sgn() function
Date: 9 Aug 2002 06:22:53
Message: <Xns92657DC807740PhiLho@204.213.191.226>
Christoph Hormann <chr### [at] gmxde> wrote in
news:3D52E135.768AB19B@gmx.de: 

> Philippe Debar wrote:
>> 
>> I think we will see a good number of such question, as it's not very
>> clear in the doc if you get there by doing a search. Should it be
>> added to the VFAQ ?
> 

> which is part of the math.inc description.  What's unclear about that?

I had to go to the previous page to see it is in the math.inc description. 
When you are a (confused) newbie, this is not obvious, it could have been 
a page from the SDL (except for the macro stuff).

-- 
--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--
Philippe Lhoste (Paris -- France)
Professional programmer and amateur artist
http://jove.prohosting.com/~philho/


Post a reply to this message

From: ingo
Subject: Re: Bug - sgn() function
Date: 9 Aug 2002 06:53:03
Message: <Xns926583BC61F08seed7@povray.org>
in news:3d52dc61$1@news.povray.org Philippe Debar wrote:

> Should it be added to the
> VFAQ ?
> 

No,

see http://www.povray.org/working-docs/id000256.html#7_10_1

Better?

Ingo


Post a reply to this message

From: Christoph Hormann
Subject: Re: Bug - sgn() function
Date: 9 Aug 2002 07:09:31
Message: <3D53A2EA.3F0A36AB@gmx.de>
ingo wrote:
> 
> [...]
> 
> see http://www.povray.org/working-docs/id000256.html#7_10_1
> 
> Better?

Well, it will look a bit strange in the HTML Help tree view or in the
table of contents:

* 7.10 math.inc
    - 7.10.1 math.inc - Float functions and macros
    - 7.10.2 math.inc - Vector functions and macros


I think it's mainly a limitation of the HTML Help system that the chapter
headings are not visible on the subchapter pages. 

Christoph

-- 
POV-Ray tutorials, IsoWood include,                 
TransSkin and more: http://www.tu-bs.de/~y0013390/  
Last updated 03 Aug. 2002 _____./\/^>_*_<^\/\.______


Post a reply to this message

Goto Latest 10 Messages Next 3 Messages >>>

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