POV-Ray : Newsgroups : povray.newusers : plotting a 3D gaussian question : Re: plotting a 3D gaussian question Server Time
2 Jul 2022 07:11:29 EDT (-0400)
  Re: plotting a 3D gaussian question  
From: Bald Eagle
Date: 27 Oct 2016 12:50:01
Message: <web.58122fc6a0290900b488d9aa0@news.povray.org>
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>}


Post a reply to this message

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