POV-Ray : Newsgroups : povray.unofficial.patches : Function problems in MegaPov Server Time
2 Sep 2024 00:17:36 EDT (-0400)
  Function problems in MegaPov (Message 1 to 7 of 7)  
From: Greg M  Johnson
Subject: Function problems in MegaPov
Date: 10 Sep 2000 13:08:34
Message: <39bbc012$1@news.povray.org>
A) NOISE3D DISALLOWS APPROPRIATE NUMBER OF PARAMETERS

First of all, the following line gives a message.
    #declare summy=summy+noise3d(minx,miny,minz);
whereas this one does not:
    #declare summy=summy+noise3d(minx);

Noise3d is a function defined over 3d space; it appears to be an
oversight not to allow three parameters in this function.

B) FUNC_ID NOT LIKED IN EXPRESSIONS.

This too gives an error message:

#declare summy=summy+obfun(minx,miny,minz);

Where I have previously defined obfun as
#declare obfun= function{pigment{object{MyObject}}} //   --OR--
#declare obfun=  function{pigment {leopard scale 30}}

It appears to be an oversight that I can insert these into an isosurface
but I cannot "use" these functions as is.


The application at hand is the making of a really cool Volume macro!


Post a reply to this message

From: Chris Huff
Subject: Re: Function problems in MegaPov
Date: 10 Sep 2000 13:34:34
Message: <chrishuff-6CF216.12362310092000@news.povray.org>
In article <39bbc012$1@news.povray.org>, "Greg M. Johnson" 
<"gregj;-)56590\""@aol.c;-)om> wrote:

> A) NOISE3D DISALLOWS APPROPRIATE NUMBER OF PARAMETERS
> 
> First of all, the following line gives a message.
>     #declare summy=summy+noise3d(minx,miny,minz);
> whereas this one does not:
>     #declare summy=summy+noise3d(minx);
> 
> Noise3d is a function defined over 3d space; it appears to be an
> oversight not to allow three parameters in this function.

It takes a vector. :-)
#declare summy = summy + noise3d(<minx,miny,minz>);
I chose this because all other POV functions that take points take them 
as vectors, isosurface functions are the exception because they don't 
have vectors.


> B) FUNC_ID NOT LIKED IN EXPRESSIONS.
> It appears to be an oversight that I can insert these into an isosurface
> but I cannot "use" these functions as is.

Not an oversight, just not a feature. The isosurface functions were 
originally not intended to be used outside of isosurfaces, they weren't 
made more general until later. I am planning to attempt to implement 
this though...
In the meantime, you can access them using eval_pattern().

-- 
Christopher James Huff
Personal: chr### [at] maccom, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tagpovrayorg, http://tag.povray.org/

<><


Post a reply to this message

From: Greg M  Johnson
Subject: Re: Function problems in MegaPov
Date: 10 Sep 2000 17:06:57
Message: <39bbf7f1$1@news.povray.org>
Cool, thanks, sorry I thought my tone was a bit harsh.
Chris Huff wrote:

> It takes a vector. :-)

Doh.

> > B) FUNC_ID NOT LIKED IN EXPRESSIONS.
> > It appears to be an oversight that I can insert these into an isosurface
> > but I cannot "use" these functions as is.
>
> Not an oversight, just not a feature. The isosurface functions were
> originally not intended to be used outside of isosurfaces, they weren't
> made more general until later. I am planning to attempt to implement
> this though...
> In the meantime, you can access them using eval_pattern().

?
How do I declare a pattern?
So far I've tried declaring a function and a pigment but no luck in getting
pov to accept anything yet.  What is a pattern?


Post a reply to this message

From: Chris Huff
Subject: Re: Function problems in MegaPov
Date: 10 Sep 2000 17:39:57
Message: <chrishuff-919033.16414710092000@news.povray.org>
In article <39bbf7f1$1@news.povray.org>, "Greg M. Johnson" 
<"gregj;-)56590\""@aol.c;-)om> wrote:

> How do I declare a pattern?

Well, the only way to do it currently is to use either a pigment 
function or pigment_pattern...or put it in a macro. But you don't need 
to declare a pattern here.

> So far I've tried declaring a function and a pigment but no luck in 
> getting pov to accept anything yet.  What is a pattern?

I assume you are talking about using a pigment in a function...how were 
you doing it?
Something like this *should* work, but it is untested:

#declare MyFunc =
function {
    pigment {PATTERN color_map {[0 rgb 0][1 rgb 1]}}
}

#declare functionVal = eval_pattern(function {MyFunc}, < X, Y, Z>);

You could even make a macro for evaluating declared functions:
#macro Eval_Function(Func, X, Y, Z)
    eval_pattern(function {Func}, < X, Y, Z>);
#end

-- 
Christopher James Huff
Personal: chr### [at] maccom, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tagpovrayorg, http://tag.povray.org/

<><


Post a reply to this message

From: Greg M  Johnson
Subject: Re: Function problems in MegaPov
Date: 10 Sep 2000 20:38:09
Message: <39bc2971@news.povray.org>
Okay, I think I got it.  I posted my Volume macro to p.t.s.-f.

Chris Huff wrote:

> In article <39bbf7f1$1@news.povray.org>, "Greg M. Johnson"
> <"gregj;-)56590\""@aol.c;-)om> wrote:
>
> > How do I declare a pattern?
>
> Well, the only way to do it currently is to use either a pigment
> function or pigment_pattern...or put it in a macro. But you don't need
> to declare a pattern here.
>
> > So far I've tried declaring a function and a pigment but no luck in
> > getting pov to accept anything yet.  What is a pattern?
>
> I assume you are talking about using a pigment in a function...how were
> you doing it?
> Something like this *should* work, but it is untested:
>
> #declare MyFunc =
> function {
>     pigment {PATTERN color_map {[0 rgb 0][1 rgb 1]}}
> }
>
> #declare functionVal = eval_pattern(function {MyFunc}, < X, Y, Z>);
>
> You could even make a macro for evaluating declared functions:
> #macro Eval_Function(Func, X, Y, Z)
>     eval_pattern(function {Func}, < X, Y, Z>);
> #end
>
> --
> Christopher James Huff
> Personal: chr### [at] maccom, http://homepage.mac.com/chrishuff/
> TAG: chr### [at] tagpovrayorg, http://tag.povray.org/
>
> <><


Post a reply to this message

From: Greg M  Johnson
Subject: Re: Function problems in MegaPov
Date: 18 Sep 2000 07:56:56
Message: <39C601C9.9A919CE3@my-dejanews.com>
Part of my problem here was that I would type in noise3d(1) and assume it was
accepting it as a float of value 1.0. It was instead in its head processing
this as <1,1,1>.

There IS a problem in an inconsistent syntax for noise3d.
In function declarations you need the vector brackets <>, in isosurfaces you
must not use them!

Chris Huff wrote:

> In article <39bbc012$1@news.povray.org>, "Greg M. Johnson"
> <"gregj;-)56590\""@aol.c;-)om> wrote:
>
> > A) NOISE3D DISALLOWS APPROPRIATE NUMBER OF PARAMETERS
> >
> > First of all, the following line gives a message.
> >     #declare summy=summy+noise3d(minx,miny,minz);
> > whereas this one does not:
> >     #declare summy=summy+noise3d(minx);
> >
> > Noise3d is a function defined over 3d space; it appears to be an
> > oversight not to allow three parameters in this function.
>
> It takes a vector. :-)
> #declare summy = summy + noise3d(<minx,miny,minz>);
> I chose this because all other POV functions that take points take them
> as vectors, isosurface functions are the exception because they don't
> have vectors.
>
> > B) FUNC_ID NOT LIKED IN EXPRESSIONS.
> > It appears to be an oversight that I can insert these into an isosurface
> > but I cannot "use" these functions as is.
>
> Not an oversight, just not a feature. The isosurface functions were
> originally not intended to be used outside of isosurfaces, they weren't
> made more general until later. I am planning to attempt to implement
> this though...
> In the meantime, you can access them using eval_pattern().
>
> --
> Christopher James Huff
> Personal: chr### [at] maccom, http://homepage.mac.com/chrishuff/
> TAG: chr### [at] tagpovrayorg, http://tag.povray.org/
>
> <><


Post a reply to this message

From: Chris Huff
Subject: Re: Function problems in MegaPov
Date: 18 Sep 2000 09:00:45
Message: <chrishuff-A9063A.08024518092000@news.povray.org>
In article <39C601C9.9A919CE3@my-dejanews.com>, 
gre### [at] my-dejanewscom wrote:

> There IS a problem in an inconsistent syntax for noise3d.
> In function declarations you need the vector brackets <>, in 
> isosurfaces you must not use them!

The syntax for isosurface functions is slightly different in all cases, 
since it only deals with individual coordinate values instead of 
vectors. For the version of noise3d() available in the rest of the code, 
I chose to use a vector to specify a point instead of three floats, to 
be consistent with all the objects, transformations, and vector 
functions which already exist.

And besides, it is shorter and easier to use this way:
noise3d(<X, Y, Z>)
noise3d(evalPoint)

than this way:

noise3d(X, Y, Z)
noise3d(evalPoint.x, evalPoint.y, evalPoint.z)

-- 
Christopher James Huff
Personal: chr### [at] maccom, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tagpovrayorg, http://tag.povray.org/

<><


Post a reply to this message

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