POV-Ray : Newsgroups : povray.advanced-users : modulo / math funktions Server Time
29 Jul 2024 20:13:25 EDT (-0400)
  modulo / math funktions (Message 11 to 19 of 19)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: Warp
Subject: Re: modulo / math funktions
Date: 30 Oct 2001 03:59:07
Message: <3bde6bdb@news.povray.org>
marabou <not### [at] availableyet> wrote:
: where is the border to an advanced question.

  I don't think there's a clear border. However, there are questions which
are clearly newbie and questions which are clearly advanced.
  When it's not clear, just post where it better fits. :)

-- 
#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: Slime
Subject: Re: modulo / math funktions
Date: 30 Oct 2001 08:52:05
Message: <3bdeb085$1@news.povray.org>
>   "How do I calculate the normal vector of an isosurface function at a
> certain point <x,y,z>?", for example.

Now *there's* a question that's been plaguing me for a while. I'll ask it
later. =)

- Slime
[ http://www.slimeland.com/ ]
[ http://www.slimeland.com/images/ ]


Post a reply to this message

From: Dave Dunn
Subject: Re: modulo / math funktions
Date: 30 Oct 2001 09:44:13
Message: <3BDEBCBB.6F77D350@aol.com>
Slime wrote:

> >   "How do I calculate the normal vector of an isosurface function at a
> > certain point <x,y,z>?", for example.
>
> Now *there's* a question that's been plaguing me for a while. I'll ask it
> later. =)

I'll be watching for the answer to that one myself, as it is holding up
isosurface support for POVGUI. I suspect it involves using trace...


Post a reply to this message

From: Slime
Subject: Re: modulo / math funktions
Date: 30 Oct 2001 09:58:37
Message: <3bdec01d$1@news.povray.org>
My guess would be evaluating various points near a point on the surface to
determine various derivatives... but I'm not really sure...

- Slime
[ http://www.slimeland.com/ ]
[ http://www.slimeland.com/images/ ]

"Dave Dunn" <poi### [at] aolcom> wrote in message
news:3BDEBCBB.6F77D350@aol.com...
>
>
> Slime wrote:
>
> > >   "How do I calculate the normal vector of an isosurface function at a
> > > certain point <x,y,z>?", for example.
> >
> > Now *there's* a question that's been plaguing me for a while. I'll ask
it
> > later. =)
>
> I'll be watching for the answer to that one myself, as it is holding up
> isosurface support for POVGUI. I suspect it involves using trace...
>


Post a reply to this message

From: Ken
Subject: Re: modulo / math funktions
Date: 30 Oct 2001 10:00:10
Message: <3BDEC07D.F8B538D9@pacbell.net>
Slime wrote:
> 
> My guess would be evaluating various points near a point on the surface to
> determine various derivatives... but I'm not really sure...

The easiest way is to just let an advanced user figure it out for you :)

-- 
Ken Tyler


Post a reply to this message

From: Ron Parker
Subject: Re: modulo / math funktions
Date: 30 Oct 2001 10:16:46
Message: <slrn9tth2v.n0q.ron.parker@fwi.com>
On Tue, 30 Oct 2001 09:44:11 -0500, Dave Dunn wrote:
> 
> 
> Slime wrote:
> 
>> >   "How do I calculate the normal vector of an isosurface function at a
>> > certain point <x,y,z>?", for example.
>>
>> Now *there's* a question that's been plaguing me for a while. I'll ask it
>> later. =)
> 
> I'll be watching for the answer to that one myself, as it is holding up
> isosurface support for POVGUI. I suspect it involves using trace...

Well, if you know how to take the derivative of the function, you just use
the gradient vector, which is < df/dx, df/dy, df/dz > where "d" is really 
the lowercase delta we use to indicate partial derivatives.

Since we're talking about arbitrary functions here, you can approximate the
gradient by using this:

#declare d = 1e-5; //(some small number; POV uses the accuracy value)
#declare Gradient=vnormalize(<F(X+d,Y,Z),F(X,Y+d,Z),F(X,Y,Z+d)>-F(X,Y,Z));

This is what POV does.  As the comment says, we use the value you specified
for the accuracy of the isosurface to do the computation.  Notice that this
does not work properly for functions with zero gradients; you should detect
that and deal with it appropriately.

--
#macro R(L P)sphere{L __}cylinder{L P __}#end#macro P(_1)union{R(z+_ z)R(-z _-z)
R(_-z*3_+z)torus{1__ clipped_by{plane{_ 0}}}translate z+_1}#end#macro S(_)9-(_1-
_)*(_1-_)#end#macro Z(_1 _ __)union{P(_)P(-_)R(y-z-1_)translate.1*_1-y*8pigment{
rgb<S(7)S(5)S(3)>}}#if(_1)Z(_1-__,_,__)#end#end Z(10x*-2,.2)camera{rotate x*90}


Post a reply to this message

From: Slime
Subject: Re: modulo / math funktions
Date: 30 Oct 2001 10:36:52
Message: <3bdec914$1@news.povray.org>
Ah, it's much as I suspected. That's pretty cool.

Notice that this
> does not work properly for functions with zero gradients; you should
detect
> that and deal with it appropriately.


How would it be possible to have a point on the surface of the object with
zero gradient in any direction? Unless the function were something like
function (x,y,z) {0}... where every point of the function is part of the
surface, which would be sort of a strange case...

--
- Slime
[ http://www.slimeland.com/ ]
[ http://www.slimeland.com/images/ ]
"Ron Parker" <ron### [at] povrayorg> wrote in message
news:slr### [at] fwicom...
> On Tue, 30 Oct 2001 09:44:11 -0500, Dave Dunn wrote:
> >
> >
> > Slime wrote:
> >
> >> >   "How do I calculate the normal vector of an isosurface function at
a
> >> > certain point <x,y,z>?", for example.
> >>
> >> Now *there's* a question that's been plaguing me for a while. I'll ask
it
> >> later. =)
> >
> > I'll be watching for the answer to that one myself, as it is holding up
> > isosurface support for POVGUI. I suspect it involves using trace...
>
> Well, if you know how to take the derivative of the function, you just use
> the gradient vector, which is < df/dx, df/dy, df/dz > where "d" is really
> the lowercase delta we use to indicate partial derivatives.
>
> Since we're talking about arbitrary functions here, you can approximate
the
> gradient by using this:
>
> #declare d = 1e-5; //(some small number; POV uses the accuracy value)
> #declare Gradient=vnormalize(<F(X+d,Y,Z),F(X,Y+d,Z),F(X,Y,Z+d)>-F(X,Y,Z));
>
> This is what POV does.  As the comment says, we use the value you
specified
> for the accuracy of the isosurface to do the computation.  Notice that
this
> does not work properly for functions with zero gradients; you should
detect
> that and deal with it appropriately.
>
> --
> #macro R(L P)sphere{L __}cylinder{L P __}#end#macro P(_1)union{R(z+_
z)R(-z _-z)
> R(_-z*3_+z)torus{1__ clipped_by{plane{_ 0}}}translate z+_1}#end#macro
S(_)9-(_1-
> _)*(_1-_)#end#macro Z(_1 _
__)union{P(_)P(-_)R(y-z-1_)translate.1*_1-y*8pigment{
> rgb<S(7)S(5)S(3)>}}#if(_1)Z(_1-__,_,__)#end#end Z(10x*-2,.2)camera{rotate
x*90}


Post a reply to this message

From: Ron Parker
Subject: Re: modulo / math funktions
Date: 30 Oct 2001 10:45:52
Message: <slrn9ttiph.n34.ron.parker@fwi.com>
On Tue, 30 Oct 2001 10:35:04 -0500, Slime wrote:
> Ah, it's much as I suspected. That's pretty cool.
> 
> Notice that this
>> does not work properly for functions with zero gradients; you should
> detect
>> that and deal with it appropriately.
> 
> 
> How would it be possible to have a point on the surface of the object with
> zero gradient in any direction?

Nobody said it has to be a point on the surface, did they?  I suppose it's
implied by the word "normal" but I thought I'd put the warning out there 
anyway.

By the way, the gradient is a direction, so the phrase "zero gradient in
any direction" is meaningless.

-- 
#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: Slime
Subject: Re: modulo / math funktions
Date: 30 Oct 2001 11:01:00
Message: <3bdecebc$1@news.povray.org>
> By the way, the gradient is a direction, so the phrase "zero gradient in
> any direction" is meaningless.

Oops, I meant "a derivative of zero in all directions."

- Slime
[ http://www.slimeland.com/ ]
[ http://www.slimeland.com/images/ ]


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

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