PreviousHomeNext

Rounded objects - Modulating corner shapes

Corners are defined by two parameters which themselves can be functions as demonstrated in the following two figures:

Radius as a function of x
Fig 1: Square rod with corner radius increasing from left to right. The profile parameter is +0.6, nearly round. This was produced by the following code:

Profile as a function of x
Fig 2: The profile parameter goes from a negative to positive. Discontinuities occur at a value of -1 on the left between a flat bevel and a rounded one, and on the right between rounding of a limited depth to hyperbolic rounding that has continue indefinitly from the corner. The radius is constant. This figure was produced by substituting the following code:

// Vers: 1.00
// Date: 19 Nov 2016
// Auth: John Greenwood

#version 3.7 ;
  global_settings {assumed_gamma 1.0 }
#include "Rounded_Objects.inc"

    camera {location <-0,20,-40> angle 10 look_at <0,0,0> }
    light_source {<-5,20,-20> colour rgb<1,1,1>}
    background { color rgb<0.2, 0.4, 0.8>  }

  #declare R_Object2 =
     function(p,r,x,y,z){
        R_Intersection(
                +R_function(p,(x  +1.5) /-r)
                +R_function(p,(x  -1.5) /+r)
                +R_function(p,(z  +1.5) /-r)
                +R_function(p,(z  -1.5) /+r)
                +R_function(p,(y  +1.5) /-r)
                +R_function(p,(y  -1.5) /+r)
                       )
                         }

  #declare Profile = .6; // change this to change the shape of the corner. 0.6 gives very close to circular
  #declare Radius = 1;   // radius when the corner is circular and surfaces are perpendicular

  isosurface {
     function  {
// start of rounded object ****************************************

//              R_Object2(Profile,.4*x+1.5,0,y,z)
                R_Object2(.4*x,Radius,0,y,z)

// end of rounded object **************************

            }
     threshold 1
     max_gradient 20
     contained_by { box {<-4.2,-3.2, -4.2>, <4.2,3.2,4.2>} }
     texture {pigment {color rgb < 1, 0.9, 0.65>}}
               }