POV-Ray : Newsgroups : povray.newusers : plotting a 3D gaussian question : Re: plotting a 3D gaussian question Server Time
24 Apr 2024 21:01:43 EDT (-0400)
  Re: plotting a 3D gaussian question  
From: Martin
Date: 27 Oct 2016 13:50:01
Message: <web.58123e18a0290900dd4282660@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:
> This ought to do it:
>
>
> #version 3.7;
>
> // 3D Gussian isosurface with peak at origin
> // October 2016, Bald Eagle
>
> #include "colors.inc"
> #include "debug.inc"
>
> global_settings {
>   assumed_gamma 1.0
> }
>
> camera {
>    location  <5, 10, -30.0>
>    look_at   <0, 0,  0.0>
>  right    x*image_width/image_height
> }
>
> light_source { < 10, 20, -50>  color White}
>
> // Create an infinite sphere around scene and allow any pigment on it
> sky_sphere{ pigment { gradient <0,1,0>
>                       color_map { [0.00 rgb <0.6,0.7,1.0>]
>                                   [0.35 rgb <0.0,0.1,0.8>]
>                                   [0.65 rgb <0.0,0.1,0.8>]
>                                   [1.00 rgb <0.6,0.7,1.0>]
>                                 }
>                       scale 2
>                     } // end of pigment
>           } //end of skysphere -------------------------------------
>
>
> #declare X0 = 0;
> #declare Z0 = 0;
> #declare A = 5;
> #declare a = 0.5;
> #declare b = 0;
> #declare c = 0.5;
>
> sphere {<0, 0, 0> 0.25 texture {pigment {Yellow} finish {specular 0.6}} }
>
> cylinder {<0, 0, 0>, <10, 0, 0> 0.1 pigment {Red} } // x axis
> cylinder {<0, 0, 0>, <0, 10, 0> 0.1 pigment {Green} } // y axis
> cylinder {<0, 0, 0>, <0, 0, 10> 0.1 pigment {Blue} } // z axis
>
> #declare Gaussian = function {y - A * exp(   -( a*pow((x-X0),2) -
> 2*b*(x-X0)*(z-Z0) + c*pow((z-Z0),2) )   ) }
>
> isosurface{ //------------------------- "sombrero"
>   function {Gaussian (x, y, z)}
>   max_gradient 10    // <=== adjust this if there is a notification in the
> message window after rendering!
>  open
>   threshold 0
>   contained_by{box{<-10, -0.1, -10>, <10, 5, 10>}}  // make sure your
> contained_by box is the right size
>
>           texture{ pigment{ spiral1 5 rotate<90,0,0>
>                             color_map{
>                                 [ 0.0 color rgb<1,1,1> ]
>                                 [ 0.5 color rgb<1,1,1> ]
>                                 [ 0.5 color rgb<1,0,0> ]
>                                 [ 1.0 color rgb<1,0,0> ]
>                                } // end color_map
>                              scale 0.5
>                            } // end pigment
>                  //normal  { bumps 0.5 scale  0.005 }
>                    finish  { phong 1 reflection 0.00 }
>                  } // end of texture ------------------
>
>
>
>   scale <1, 1, 1>
>   rotate <0,0,0>
>   translate <0, -A, 0>
> } // end of isosurface ----------------
>
> box{<-10, -0.1, -10>, <10, 5, 10> pigment {rgbt <1, 1, 1, 0.9>} translate <0,
> -A, 0>}

Thanks a lot! This worked like a charm. I just have one more problem, now my
green balls are disappearing behind my gaussian function, if I make it too
transparent then I wont see the Gaussian. Is there a possibility to make the
green balls "inside" the gaussian much stronger so they are able to be seen
through the gaussian ?

http://www.directupload.net/file/d/4521/t8e5wc5t_png.htm


Post a reply to this message

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