POV-Ray : Newsgroups : povray.newusers : isosurfaces? Server Time
26 Nov 2024 21:26:46 EST (-0500)
  isosurfaces? (Message 1 to 10 of 13)  
Goto Latest 10 Messages Next 3 Messages >>>
From: Matthew Pace
Subject: isosurfaces?
Date: 3 Nov 2003 22:39:10
Message: <matt-pace-BE21CA.19390803112003@netplex.aussie.org>
Hello, I am currently having trouble with isosurfaces.  I am currently 
checking out the documentation, 
http://www.econym.demon.co.uk/isotut/index.htm  and
http://www.f-lohmueller.de/pov_tut/pov__eng.htm

As far as i can tell, everything seems fine syntax wise, but when I write

#declare Sphere= function {x*x+y*y+z*z-R*R} //both with and without semi 
colon at the end of the declare statement

isosurface
{
   function{Sphere(/*any vars here, as long as theres 4*/)}
   threshold 0
   texture{...}
}//lets say this is line 37

i get an error stating that I placed an } aat line 37 where there was an 
expected parameter/float.

I have tried adding other parameters, but i always get this error.  why 
is it?

Thanks, Matt


Post a reply to this message

From: Christopher James Huff
Subject: Re: isosurfaces?
Date: 3 Nov 2003 23:42:00
Message: <cjameshuff-EACD10.23414103112003@netplex.aussie.org>
In article <mat### [at] netplexaussieorg>,
 Matthew Pace <mat### [at] lycoscom> wrote:

> Hello, I am currently having trouble with isosurfaces.  I am currently 
> checking out the documentation, 
> http://www.econym.demon.co.uk/isotut/index.htm  and
> http://www.f-lohmueller.de/pov_tut/pov__eng.htm

Those are third-party tutorials, not the official documentation as you 
imply. And the second page doesn't have anything about isosurfaces, as 
far as I can tell.


> #declare Sphere= function {x*x+y*y+z*z-R*R} //both with and without semi 
> colon at the end of the declare statement
...snip...
> i get an error stating that I placed an } aat line 37 where there was an 
> expected parameter/float.

You didn't specify that R was a parameter:
#declare Sphere = function (x, y, z, R) {x*x+y*y+z*z-R*R}

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tagpovrayorg
http://tag.povray.org/


Post a reply to this message

From: Mike Williams
Subject: Re: isosurfaces?
Date: 4 Nov 2003 01:04:49
Message: <sE0oeAALtzp$EwYn@econym.demon.co.uk>
Wasn't it Matthew Pace who wrote:
>Hello, I am currently having trouble with isosurfaces.  I am currently 
>checking out the documentation, 
>http://www.econym.demon.co.uk/isotut/index.htm  and
>http://www.f-lohmueller.de/pov_tut/pov__eng.htm
>
>As far as i can tell, everything seems fine syntax wise, but when I write
>
>#declare Sphere= function {x*x+y*y+z*z-R*R} //both with and without semi 
>colon at the end of the declare statement
>
>isosurface
>{
>   function{Sphere(/*any vars here, as long as theres 4*/)}
>   threshold 0
>   texture{...}
>}//lets say this is line 37
>
>i get an error stating that I placed an } aat line 37 where there was an 
>expected parameter/float.
>
>I have tried adding other parameters, but i always get this error.  why 
>is it?
>
>Thanks, Matt


There's nothing wrong with the code fragments that you've shown here
(except that it should be "any vars here, as long as there's 3", if you
give it 4 you get "Invalid number of parameters: 4 supplied, 3
required"). My guess would be that your texture{...} or some other
modifier that you've omitted is incomplete.

If you still can't spot your typo, you'll need to post a larger chunk of
code, and actually copy the code from the scene rather than retyping it.

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: Matthew Pace
Subject: Re: isosurfaces?
Date: 4 Nov 2003 01:40:08
Message: <matt-pace-DE90CA.22400503112003@netplex.aussie.org>
Alrighty, Thanks to you guys, I shall test out the parameter 
declarations (correct term?), and if that does not work, I will post my 
code.  Thanks a lot.


Post a reply to this message

From: Matthew Pace
Subject: Re: isosurfaces?
Date: 4 Nov 2003 01:45:12
Message: <matt-pace-14D9EE.22451003112003@netplex.aussie.org>
Holy Jumping Mother of God!  It worked!  Sorta, anyways.  It rendered, 
yes, but there was nothing there.  My guess is because I messed up 
somewhere along with placing the objects and camera.

in case anyone was interested still, this is the fixed code:

#declare AmbientLight= 0;
camera
{
   location <0,.5,-7>
   look_at  <0,0,0>
}

light_source
{
   <.5,11,-3>
   color rgb 2
   spotlight
   radius 3
   falloff 15
   tightness 5
   point_at <0,0,0>
   area_light
   <.5,0,0>,<0,.5,0>,5,5
   adaptive 1
   jitter
}
plane
{
   y,0
   hollow
   texture
   {
      pigment
      {
         checker
            color rgb <.8,.8,.8>
            color rgb <0,0,.25>
      }
   }
}

#declare Sphere=function (x,y,z,R) {x*x+y*y+z*z}


isosurface
{
   function{Sphere(2,2,2,4)}
   threshold 0
   contained_by {box {-5,5}}
   texture
   {
      pigment
      {
         color rgb .6
      }
   }


Post a reply to this message

From: Tom Melly
Subject: Re: isosurfaces?
Date: 4 Nov 2003 05:05:55
Message: <3fa77a03$1@news.povray.org>
"Matthew Pace" <mat### [at] lycoscom> wrote in message
news:mat### [at] netplexaussieorg...
> Holy Jumping Mother of God!  It worked!  Sorta, anyways.  It rendered,
> yes, but there was nothing there.  My guess is because I messed up
> somewhere along with placing the objects and camera.
>
> in case anyone was interested still, this is the fixed code:

> #declare Sphere=function (x,y,z,R) {x*x+y*y+z*z}
>
> isosurface
> {
>    function{Sphere(2,2,2,4)}
>    threshold 0
>    contained_by {box {-5,5}}
>    texture
>    {
>       pigment
>       {
>          color rgb .6
>       }
>    }

Close - you specify the R param, but then don't do anything with it.
Consequently, with a threshold of 0, you have a 0-width sphere (i.e. the only
points where your equation evaluates to =< 0 is at <0,0,0>).

Next, you correctly specify (x,y,z,R) as params to the function, but then pass
the constant (2,2,2,4), instead of (x,y,z,4). You want the isosurface to be
evaluated for all points of (x,y,z) within the contained_by box, not just for
<2,2,2>.

Also, and less importantly, you probably want {pow(x*x+y*y+z*z,0.5)-R}, since
otherwise you sphere is going to have a radius of the square-root of R, rather
than R (which is fine, but breaks the doctrine of least surprise ;)

Finally, once you sort these problems out, you're still going to have trouble
because you haven't specified a max_gradient, and the default (1.1 iirc) is too
low. So...

Try:

#declare FSphere=function (x,y,z,R) {pow(x*x+y*y+z*z,0.5) - R}
isosurface
{
  function{FSphere(x,y,z,2)}
  threshold 0
  contained_by {box {-5,5}}
  max_gradient 13
  texture{
    pigment{color rgb .6}
  }
}

One final point - your texture is wrong. You should specify a perfect reflective
texture for all spheres on checked planes, otherwise you are breaking the terms
of the pov-licence.


Post a reply to this message

From: Christoph Hormann
Subject: Re: isosurfaces?
Date: 4 Nov 2003 05:32:02
Message: <afbk71-cd6.ln1@triton.imagico.de>
Tom Melly wrote:
> [...]
> 
> #declare FSphere=function (x,y,z,R) {pow(x*x+y*y+z*z,0.5) - R}
> isosurface
> {
>   function{FSphere(x,y,z,2)}
>   threshold 0
>   contained_by {box {-5,5}}
>   max_gradient 13
>   texture{
>     pigment{color rgb .6}
>   }
> }

Actually you should use sqrt() instead of pow(,0.5).

And since the radius R is a render time constant it is not necessary for 
it to be a parameter:

#declare R=2;

#declare FSphere=function {sqrt(x*x+y*y+z*z) - R}

isosurface
{
   function{FSphere(x,y,z)}
   ...
}

And this is exctly how it is shown in the isosurface tutorial in the 
documentation.

Christoph

-- 
POV-Ray tutorials, include files, Sim-POV,
HCR-Edit and more: http://www.tu-bs.de/~y0013390/
Last updated 25 Oct. 2003 _____./\/^>_*_<^\/\.______


Post a reply to this message

From: Tom Melly
Subject: Re: isosurfaces?
Date: 4 Nov 2003 05:45:50
Message: <3fa7835e$1@news.povray.org>
"Christoph Hormann" <chr### [at] gmxde> wrote in message
news:afb### [at] tritonimagicode...

> Actually you should use sqrt() instead of pow(,0.5).

True (but I'm too lazy to check the docs, and couldn't remember how the keyword
was spelt ;). Also, never a bad idea to remind a newbie that pow(n,0.5) and
sqrt(n) are the same thing...

>
> And since the radius R is a render time constant it is not necessary for
> it to be a parameter:
>
> #declare R=2;
>

Also true - still, I quite liked the example of passing x,y,z and another param.
I don't suppose there's any chance that pov will recognise that R is a constant
and perform an optimisation?*

* yeah, right, and monkeys will fly out of my butt.


Post a reply to this message

From: Warp
Subject: Re: isosurfaces?
Date: 4 Nov 2003 07:49:11
Message: <3fa7a046@news.povray.org>
Tom Melly <tom### [at] tomandlucouk> wrote:
> Also, and less importantly, you probably want {pow(x*x+y*y+z*z,0.5)-R}, since
> otherwise you sphere is going to have a radius of the square-root of R, rather
> than R (which is fine, but breaks the doctrine of least surprise ;)

  Why use a heavy solution to a simple problem?
  If the R needs to be squared, then simply square it. This will probably
result in much faster renderings, the result being equal:

#declare FSphere = function(x,y,z,R) { x*x+y*y+z*z-R*R }

-- 
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -


Post a reply to this message

From: Warp
Subject: Re: isosurfaces?
Date: 4 Nov 2003 07:50:34
Message: <3fa7a09a@news.povray.org>
Christoph Hormann <chr### [at] gmxde> wrote:
> Actually you should use sqrt() instead of pow(,0.5).

  How about simply squaring the radius (R*R) instead of using the slow
sqrt() function?-)

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


Post a reply to this message

Goto Latest 10 Messages Next 3 Messages >>>

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