POV-Ray : Newsgroups : povray.advanced-users : Spherical isosurface : Re: Spherical isosurface Server Time
25 Apr 2024 02:14:54 EDT (-0400)
  Re: Spherical isosurface  
From: clipka
Date: 29 Nov 2016 15:26:51
Message: <583de48b$1@news.povray.org>
Am 29.11.2016 um 00:42 schrieb Mike Horvath:
> Clipka gave me these formulas to generate a cylindrical isosurface.
> 
> #declare fL = function(x,y,z) {y*100}
> #declare fC = function(x,y,z) {sqrt(x*x+z*z)*128}
> #declare fH = function(x,y,z) {atan2d(x,z)}
> 
> What would be a formula for a sphere? L should be latitude, H longitude,
> and C radius.

What you need is _not_ "formulas to generate a [spherical] isosurface".

What you need is formulas to convert from a point in cartesian space to
a colour in the spherical (as oppsed to cylindrical) LCh model.

This is just a small building block in your isosurface function, and in
and of itself has no special relation to isosurfaces whatsoever. (You'll
need to use the same formula to eventually compute an RGB colour pigment.)


If Chroma (C) is to be (spherical) radius, that part is easy:

    #declare fC = function(x,y,z) { sqrt(x*x+y*y+z*z)*CONST }

Hue (H) should be unchanged:

    #declare fH = function(x,y,z) { atan2(x,z)*CONST }

Luminance gets a bit more complicated: You have to use an atan-based
formula to get an angle, but you must plug in the y coordinate and the
distance between the y axis; the latter is equal to sqrt(x*x+z*z), so
this gives you:

    #declare fL = function(x,y,z) { atan2(sqrt(x*x+z*z),y)*CONST }

Choose CONST values as needed; atan2()*CONST may happen to be replacable
by atan2d() again.


Post a reply to this message

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