POV-Ray : Newsgroups : povray.general : isosurface -> mesh? : Re: isosurface -> mesh? Server Time
7 Aug 2024 07:18:35 EDT (-0400)
  Re: isosurface -> mesh?  
From: Mike Williams
Date: 27 Dec 2001 13:19:30
Message: <wF1LeAA3MuK8Ew$Y@econym.demon.co.uk>
Wasn't it Ruy who wrote:
>> Such a facility is available for parametric isosurfaces.
>>
>> Is it possible to convert an arbitrary isosurface function into
>> parametric co-orinates?
>
>I've been there. There is no trivial method for achieving this. It gets ugly
>just as soon as you leave the trigonometric domain.

I think it might be possible for functions that can be solved for one of
the variables. I.e. if you can convert from

                F(x,y,z) = 0
to
                z = G(x,y)

Then you should be able to express the function as the parametrics

                x = u
                y = v
                z = G(u,v)

For example, the sphere given by

        #declare  F = function {x*x + y*y + z*z - 1}

can be converted into the two sets of parametrics

        #declare Fx=function(U,V){U}
        #declare Fy=function(U,V){V}
        #declare Fz=function(U,V){sqrt(1-U*U-V*V)}
and
        #declare Fx=function(U,V){U}
        #declare Fy=function(U,V){V}
        #declare Fz=function(U,V){-sqrt(1-U*U-V*V)}

(One using the +ve sqrt and one the -ve)

Parts of this can be converted into a mesh using Ingo's include file.
Unfortunately it freaks out when asked to interpret regions of <U,V>
where the surface doesn't exist.

#include "functions.inc"

camera { location  <1, 1, -2> look_at <0, 0, 0>}

sky_sphere { pigment {
    function{abs(y)}
    color_map { [0.0 color blue 0.6] [1.0 color rgb 1] } 
  }
}

light_source {<-100,200,-100> colour rgb 1}


// a sphere
#declare  F = function {x*x + y*y + z*z - 1}

//converted to a parametric
#declare Fx=function(U,V){U}
#declare Fy=function(U,V){V}
#declare Fz=function(U,V){sqrt(1-U*U-V*V)}

#declare Umin=-0.7;
#declare Umax=0.7;
#declare Vmin=-0.7;
#declare Vmax=0.7;

#declare Iter_U = 20;
#declare Iter_V = 20;

//Converted to a mesh
#include "param.inc"
Parametric()

object {Surface
  pigment {rgb 0.9}
  finish {phong 0.5 phong_size 10}
  no_shadow
}


//The other side
#declare Fz=function(U,V){-sqrt(1-U*U-V*V)}

Parametric()

object {Surface
  pigment {rgb 0.9}
  finish {phong 0.5 phong_size 10}
  no_shadow
}

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

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