POV-Ray : Newsgroups : povray.newusers : Isosurface problem : Isosurface problem Server Time
13 May 2024 19:43:45 EDT (-0400)
  Isosurface problem  
From: John Greenwood
Date: 29 Jan 2014 05:35:00
Message: <web.52e8d82bcfb9f6d0a7cafab50@news.povray.org>
I have created an isosurface with _exactly_ the shape I want, but there is one
region where generation breaks down, I think because of surfaces coinciding.

Any suggestions?

#version 3.7;
global_settings { assumed_gamma 1.0 }
#default{ finish{ ambient 0.1 diffuse 0.9 }}

#include "colors.inc"
#include "functions.inc"

//-------------------------------------------

#declare CamLoc = < 0, 0,-20>;

camera {
 location CamLoc
        right     x*image_width/image_height
 look_at < 0, 0, 0>
 angle 30
}

light_source {CamLoc color White*0.35}
light_source {<-50, 150,-75> color White}

background { color rgb<1,1,1>*0.35 }


/*
box {<-4,-3, 1>, < 4, 3, 2>
 texture {
  pigment {checker color rgb < 0.05, 0, 0.35>, color White}
  finish {ambient 0 diffuse 1}
 }
}
*/
//-------------------------------------------
#local Yo = 0.08;
#local Zo = .635;
#local Xa = 0.75;
#local Yb = 1.6;
#local Rr = 2.560;
#local Ko = 0.23;


#declare IsoFinish =
finish {
 ambient 0 diffuse 1
 specular 1 roughness 0.02
 brilliance 2
}

#declare  Shape =
intersection   {
isosurface {

// I think the isosurface function does not like sqrt with negative roots.
// This gives a very strange result
//    function {-sqrt((1-pow(z/Zo,2))*pow((y-Rr+sqrt(pow(Rr,2)-pow(z,2))),2))
+pow(x,2)}

// This works except fo the "Ears" where the parabola reflects
    function {-((1-pow(z/Zo,2))*pow((y-Rr+sqrt(pow(Rr,2)-pow(z,2))),2))
+pow(x,4)}
    max_gradient 200
    accuracy     0.001
    threshold 0
    contained_by {box {<0,0,-1>,<2,2,1>}}
           }
// This is the shape I want; But....
// This chops off the ears but the surfaces coincide at the corners and we get a
hole
     cylinder {<-1,Rr,0>,<2,Rr,0>,Rr}


   texture {
  pigment {color  rgb<0.8,0,0>}
  finish {IsoFinish}}
        rotate <180, 90, 0>     }

#declare Spread = 3;
 object {Shape rotate <-90, 45, -90> translate <-Spread, Spread, 0>}
 object {Shape rotate <0, 90, 0> translate <-Spread, 0, 0>}
 object {Shape rotate <0, 45, 45> translate <-Spread, -Spread, 0>}

 object {Shape rotate <-120, 0, 0> translate <0, Spread, 0>}
 object {Shape rotate <0, 0, 0> translate <0, 0, 0>}
 object {Shape rotate <45, 0, 0> translate <0, -Spread, 0>}

 object {Shape rotate <45, 45, 45> translate <Spread, Spread, 0>}
 object {Shape rotate <0, -45, 0> translate <Spread, 0, 0>}
 object {Shape rotate <-100, 45, 0> translate <Spread, -Spread, 0>}


Post a reply to this message

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