POV-Ray : Newsgroups : povray.advanced-users : Spherical isosurface Server Time
24 Apr 2024 02:13:02 EDT (-0400)
  Spherical isosurface (Message 11 to 17 of 17)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: Mike Horvath
Subject: Re: Spherical isosurface
Date: 29 Nov 2016 17:04:33
Message: <583dfb71$1@news.povray.org>
On 11/29/2016 3:26 PM, clipka wrote:
> 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.
>

Wikipedia says it should be more like

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

Do you agree?

Mike


Post a reply to this message

From: Mike Horvath
Subject: Re: Spherical isosurface
Date: 29 Nov 2016 17:07:14
Message: <583dfc12$1@news.povray.org>
On 11/29/2016 5:04 PM, Mike Horvath wrote:
> On 11/29/2016 3:26 PM, clipka wrote:
>> 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.
>>
>
> Wikipedia says it should be more like
>
>     #declare fL = function(x,y,z) { atan2(sqrt(x*x+y*y+z*z),y)*CONST }
>
> Do you agree?
>
> Mike

Wait! I scanned your response too quickly. Wikipedia gives this:

	acos(y/r)

which is totally different from what you suggest. Are they equivalent?

Mike


Post a reply to this message

From: Mike Horvath
Subject: Re: Spherical isosurface
Date: 29 Nov 2016 17:12:52
Message: <583dfd64$1@news.povray.org>
On 11/29/2016 3:26 PM, clipka wrote:
> 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.
>

Also, don't I need to divide by 180 first before multiplying by the 
constant?

atan2d(sqrt(x*x+z*z),y)/180*100

Mike


Post a reply to this message

From: clipka
Subject: Re: Spherical isosurface
Date: 29 Nov 2016 19:01:44
Message: <583e16e8$1@news.povray.org>
Am 29.11.2016 um 23:07 schrieb Mike Horvath:
> On 11/29/2016 5:04 PM, Mike Horvath wrote:
>> On 11/29/2016 3:26 PM, clipka wrote:
>>> 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.
>>>
>>
>> Wikipedia says it should be more like
>>
>>     #declare fL = function(x,y,z) { atan2(sqrt(x*x+y*y+z*z),y)*CONST }
>>
>> Do you agree?
>>
>> Mike
> 
> Wait! I scanned your response too quickly. Wikipedia gives this:
> 
>     acos(y/r)
> 
> which is totally different from what you suggest. Are they equivalent?

I think so. Wikipedia is right, and I'm confident my formula is also
correct. I haven't verified the equivalence algebraically though.


Post a reply to this message

From: clipka
Subject: Re: Spherical isosurface
Date: 29 Nov 2016 19:07:26
Message: <583e183e$1@news.povray.org>
Am 29.11.2016 um 23:12 schrieb Mike Horvath:
> On 11/29/2016 3:26 PM, clipka wrote:
>> 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.
>>
> 
> Also, don't I need to divide by 180 first before multiplying by the
> constant?
> 
> atan2d(sqrt(x*x+z*z),y)/180*100

Well, that's equivalent to

    atan2(...)/pi*100

so it's just a matter of choosing a fitting CONST for your purposes ;)

But yes, the way you're doing it is probably right for your application.

I later noticed that you may need to add another constant though,
depending on the nominal value range.


Post a reply to this message

From: Alain
Subject: Re: Spherical isosurface
Date: 1 Dec 2016 18:40:40
Message: <5840b4f8$1@news.povray.org>
Le 16-11-28 à 18:42, Mike Horvath a écrit :
> 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.
>
> Thanks.

When I want a isosurface sphere, I use the following:

#include "functions.inc"

Then, I use the f_sphere(x,y,z,radius) function that use an internal 
function. Faster and simple.

If you want the function to use in an isosurface, it's
sqrt(pow(x,2)+pow(y,2)+pow(z,2))-Radius to be used with a threshold of zero.
Also, you can use sqrt(pow(x,2)+pow(y,2)+pow(z,2)) and use the threshold 
to controll the radius.

Using 3 functions is if you want to make a parametric sphere. It's not 
the same thing.


Alain


Post a reply to this message

From: Mike Horvath
Subject: Re: Spherical isosurface
Date: 1 Dec 2016 20:16:12
Message: <5840cb5c$1@news.povray.org>
On 12/1/2016 6:41 PM, Alain wrote:
> Le 16-11-28 à 18:42, Mike Horvath a écrit :
>> 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.
>>
>> Thanks.
>
> When I want a isosurface sphere, I use the following:
>
> #include "functions.inc"
>
> Then, I use the f_sphere(x,y,z,radius) function that use an internal
> function. Faster and simple.
>
> If you want the function to use in an isosurface, it's
> sqrt(pow(x,2)+pow(y,2)+pow(z,2))-Radius to be used with a threshold of
> zero.
> Also, you can use sqrt(pow(x,2)+pow(y,2)+pow(z,2)) and use the threshold
> to controll the radius.
>
> Using 3 functions is if you want to make a parametric sphere. It's not
> the same thing.
>
>
> Alain

I don't want a sphere. I want an irregular shape in a spherical 
coordinate system.

Mike


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

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