POV-Ray : Newsgroups : povray.general : rounded_objects: a new feature? : Re: rounded_objects: a new feature? Server Time
22 Jun 2024 21:54:18 EDT (-0400)
  Re: rounded_objects: a new feature?  
From: John Greenwood
Date: 18 Sep 2016 07:00:01
Message: <web.57de7375696ad3a7cafab50@news.povray.org>
"John Greenwood" <nomail@nomail> wrote:
> And here it is:

> // Demonstration of plane elements for rounded objects

And now spheres:

// This work is licensed under the Creative Commons Attribution 3.0 Unported
License.
// To view a copy of this license, visit
http://creativecommons.org/licenses/by/3.0/
// or send a letter to Creative Commons, 444 Castro Street, Suite 900, Mountain
View,
// California, 94041, USA.

// Demonstration of Sphere elements for rounded objects

// Vers: 1.00
// Date: 18 Sept 2016
// Auth: John Greenwood

#version 3.7 ;

#include "colors.inc"

camera {location <0,0,22> angle 30 look_at <0,0,0> }

  background { color rgb<0.2, 0.4, 0.8>  }
  light_source {<5,20,10> color White}
  global_settings {assumed_gamma 1.0 }


  #declare R_function = function( F,q,s){

select((F>q)-(F<-q),2*(q<0)-1,s*pow(F/q,5)-(2*s+.5)*pow(F/q,3)+(1.5+s)*F/q,1-2*(q<0))
                                        }


  isosurface {
     function    {
               R_function(-sqrt(pow(x-1,2)+pow(y,2)+pow(z,2))+1,-1,0)
               +R_function(-sqrt(pow(x+1,2)+pow(y,2)+pow(z,2))+1 ,-.5,0)
                 }
     threshold  1
      max_gradient 4
     contained_by { box { -2, 2 } }
  texture {pigment {color rgb < 1, 0.9, 0.65>}}
            translate < 3,3,0>  }

  isosurface {
     function    {
               R_function(-sqrt(pow(x-1,2)+pow(y,2)+pow(z,2))+1,-.5,.3)
               +R_function(-sqrt(pow(x+1,2)+pow(y,2)+pow(z,2))+1 ,-.5,-.4)
                 }
     threshold  1
      max_gradient 3
     contained_by { box { -2, 2 } }
  texture {pigment {color rgb < 1, 0.9, 0.65>}  }
      translate <-3,3,0>        }

  isosurface {
     function     {

R_function(-sqrt(pow(x-1,2)+pow(y,2)+pow(z,2))+1,min(-.3,-.5-.4*-y),0)

+R_function(-sqrt(pow(x+1,2)+pow(y,2)+pow(z,2))+1,min(-.3,-.5-.4*+y),0)
                 }
     threshold  1
      max_gradient 5
     contained_by { box { -2, 2 } }
  texture {pigment {color rgb < 1, 0.9, 0.65>}  }
     translate <3,-0,0>         }

  isosurface {
     function    {
                R_function(-sqrt(pow(x-1,2)+pow(y,2)+pow(z,2))+1,-.5,y)
               +R_function(-sqrt(pow(x+1,2)+pow(y,2)+pow(z,2))+1,-.5,-y)
                 }
     threshold  1
      max_gradient 4
     contained_by { box { -2, 2 } }
  texture {pigment {color rgb < 1, 0.9, 0.65>}  }
      translate <-3,-0,0>        }

  isosurface {
     function     {
                R_function(-sqrt(pow(x-1,2)+pow(y,2)+pow(z,2))+.5,-2,-.5)
               +R_function(-sqrt(pow(x+1,2)+pow(y,2)+pow(z,2))+1,-1,0)
                 }
     threshold  1
      max_gradient 3
     contained_by { box { -2, 2 } }
  texture {pigment {color rgb < 1, 0.9, 0.65>}  }
     translate <3,-3,0>         }

  isosurface {
     function    {
                R_function(-sqrt(pow(x-1,2)+pow(y,2)+pow(z,2))+.5,-1,0)
               +R_function(-sqrt(pow(x+1,2)+pow(y,2)+pow(z,2))+1,-1.5,0)
                 }
     threshold  1
      max_gradient 4
     contained_by { box { -2, 2 } }
  texture {pigment {color rgb < 1, 0.9, 0.65>}  }
      translate <-3,-3,0>        }


Post a reply to this message

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