POV-Ray : Newsgroups : povray.newusers : Newbie isosurface question : Re: Newbie isosurface question Server Time
29 Jul 2024 12:26:04 EDT (-0400)
  Re: Newbie isosurface question  
From: Mike Williams
Date: 13 Dec 2005 15:06:32
Message: <nFH6uAA$mynDFwqU@econym.demon.co.uk>
Wasn't it mwhidden who wrote:
>POV-Ray 3.6.1a.icl8
>
>It seems to me that in an isosurface, one can substitute sin(f_th(x,y,z))
>for x and cos(f_th(x,y,z)) for z, and that bears out in simple testing.
>
>Next I try to construct a cylinder via (x*x + z*z - 1), which works like a
>champ. Then when I substitute the sin/cos of f_th() for x and z, it goes
>all hooey and I get a solid box with a bunch of speckles, regardless (it
>seems) of max_gradient settings.
>
>Anyone have any idea why?

Although the function "x" and the function "sin(f_th(x,y,z))" are zero
at the same places, they have different values at points where they are
not zero.

#local i=0;
#while(i < 6)
  #debug concat(str(Funcs[i](0.1,0.2,0.3),-1,-1),"\n")
  #declare i=i+1;
#end

There's a famous trigonometrical identity
        sin squared + cos squared = 1

If we apply that identity to this function
  function{ pow(SinTest(x,y,z),2) + pow(CosTest(x,y,z),2) - 1}
we can see that it always returns the value zero

We'd therefore expect that every point inside the container would be a
point on the surface, but the isosurface code isn't written in a way
that can take advantage of that. The tracer tries to find a point on the
ray where the function is greater than zero and another where the
function is less than zero and then produces successive approximations
to the point where the function changes sign. If the function is zero
everywhere, then that strategy gets confused. The speckles are being
produced by tiny rounding errors, the calculated values vary very
slightly from zero in one direction or the other causing the tracer to
think it has found a surface point.

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

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