POV-Ray : Newsgroups : povray.beta-test : radius of f_sphere function : radius of f_sphere function Server Time
18 Apr 2024 18:26:29 EDT (-0400)
  radius of f_sphere function  
From: ingo
Date: 10 Jan 2019 05:58:48
Message: <XnsA9D379DE45518seed7@news.povray.org>
Changeing the radius of the internal f_sphere function has less effect 
than I expected.

from the source fnintern.cpp:

DBL f_sphere(FPUContext *ctx, DBL *ptr, unsigned int) // 61
{
    return (-PARAM(0) + sqrt(PARAM_X * PARAM_X + PARAM_Y * PARAM_Y + 
PARAM_Z * PARAM_Z));
}

maybe something like:

  return (sqrt(PARAM_X * PARAM_X + PARAM_Y * PARAM_Y + PARAM_Z * 
PARAM_Z)/PARAM(0));

Scene for comparing:

#version 3.7;
global_settings{ assumed_gamma 1.0 }
#default{ finish{ ambient 1 diffuse 0 emission 0}} 
#include "functions.inc"
camera {
  orthographic
  location <0,0,-1>
  look_at  <0,0,0>
  right x*image_width/image_height
}
// +w200 +h200

#declare Fn_Sphere = function(x,y,z,R){sqrt(pow(x,2)+pow(y,2)+pow(z,2))/R}
box {
  <-.5,-.5,0>, <.5,.5,0>
  texture {
    pigment {
      //expect to see two full circles
      function{f_sphere(x,y,z,0.25)}
      //function{Fn_Sphere(x,y,z,0.25)}
      color_map {
        [0.0 color rgb 0.0 ]
        [1.0 color rgb 1.0 ]
      }
      scale 1
    }
  }
}


ingo


Post a reply to this message

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