POV-Ray : Newsgroups : povray.advanced-users : Spherical isosurface : Re: Spherical isosurface Server Time
25 Apr 2024 17:35:13 EDT (-0400)
  Re: Spherical isosurface  
From: Mike Horvath
Date: 29 Nov 2016 12:03:27
Message: <583db4df$1@news.povray.org>
On 11/29/2016 7:54 AM, Bald Eagle wrote:
> Mike Horvath <mik### [at] gmailcom> wrote:
>
>> What would be a formula for a sphere?
>
> I always start here:
>
> http://www.econym.demon.co.uk/isotut/
>
> whenever I have any questions about isosurfaces.

That tutorial only gives a single function for a sphere. I need separate 
functions for latitude, longitude and radius, that get combined later 
using an additional function.

Like this:

#declare fD = function(C) {abs(C-0.5)-0.5}
#declare fDist = function(Dr,Dg,Db) {max(Dr,Dg,Db)}
#declare fR = function(L,C,H) {convertLCH2RGBa1(L,C,H)}
#declare fG = function(L,C,H) {convertLCH2RGBa2(L,C,H)}
#declare fB = function(L,C,H) {convertLCH2RGBa3(L,C,H)}
#declare fL = function(x,y,z) {90+atand(x/y)}			// wrong!
#declare fC = function(x,y,z) {sqrt(x*x+z*z)*128}
#declare fH = function(x,y,z) {atan2d(x,z)}

#declare fFinal = function(L,C,H)
{
	fDist
	(
		fD(fR(L,C,H)),
		fD(fG(L,C,H)),
		fD(fB(L,C,H))
	)
}

Mike


Post a reply to this message

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