|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
The following function transforms a sphere such that it is expanded
logarithmically along the y axis. What I would like to do next is to
expand a sphere based on its distance from the origin instead. Any
ideas? Of course, if the sphere is located a the origin like my example
it will still look like a sphere.
-Mike
#local Temp_fnc1 = function
{
1 - min(1, sqrt(x*x + y*y + z*z))
}
#local Temp_fnc3 = function
{
max(0,min(1,Temp_fnc1(x, log(y + 1) / log(2),z)))
}
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
SharkD schrieb:
> The following function transforms a sphere such that it is expanded
> logarithmically along the y axis. What I would like to do next is to
> expand a sphere based on its distance from the origin instead. Any
> ideas? Of course, if the sphere is located a the origin like my example
> it will still look like a sphere.
You'd need to (a) define the center of the sphere, (b) compute the
desired radius from the distance to the origin, (c) redefine your
Temp_fnc1 to take into account a radius, and (e) offset the parameters
to Temp_fnc1 by the center, as in:
#local Center = <...>; // (a)
#local Radius = log(vlength(Center)+1) / log(2); // (b)
#local Temp_fnc1 = function
{
1 - min(1, sqrt(x*x + y*y + z*z)/Radius) // (c)
}
#local Temp_fnc3 = function
{
Temp_fnc1(x-Center.x,y-Center.y,z-Center.z) // (d)
}
I guess this definition for Temp_fnc3 might run into problems though,
due to POV-Ray's general inability to use vector stuff in functions; you
may need to define temporary variables for the Center vector components,
as in:
#local CenterX = Center.x;
#local CenterY = Center.y;
#local CenterZ = Center.z;
#local Temp_fnc3 = function
{
Temp_fnc1(x-CenterX,y-CenterY,z-CenterZ)
}
Note that this will produce just a single sphere. To get multiples of
them, you might want to add multiple instances of that function, as in:
#macro Temp_Fnc(Center)
#local Radius = log(vlength(Center)+1)
#local Temp_fnc1 = function
{
1 - min(1, sqrt(x*x + y*y + z*z)/Radius)
}
#local CenterX = Center.x;
#local CenterY = Center.y;
#local CenterZ = Center.z;
( Temp_fnc1(x-CenterX,y-CenterY,z-CenterZ) )
#end
#local Temp_fnc3 = function
{
Temp_Fnc(<0,1,0>) +
Temp_Fnc(<0,3,0>) +
Temp_Fnc(<0,10,0>) +
...
}
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
clipka wrote:
> You'd need to (a) define the center of the sphere, (b) compute the
> desired radius from the distance to the origin, (c) redefine your
> Temp_fnc1 to take into account a radius, and (e) offset the parameters
> to Temp_fnc1 by the center, as in:
Thanks. I'll try it out tonight or tomorrow.
> I guess this definition for Temp_fnc3 might run into problems though,
> due to POV-Ray's general inability to use vector stuff in functions; you
> may need to define temporary variables for the Center vector components,
> as in:
Yeah, I have trouble with the algebraic functions. I use another
program, called GeoGebra, to test out operations before I do them in
POVray. Unfortunately, this program uses algebraic functions in the
format of f(x) = 2 * x, which can sometimes be hard two convert to
POVray's format of 0 = 2 * x - y.
-Mike
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
SharkD wrote:
> Unfortunately, this program uses algebraic functions in the
> format of f(x) = 2 * x, which can sometimes be hard two convert to
> POVray's format of 0 = 2 * x - y.
I probably misunderstood that problem ... isn't the conversion just
subtracting the function value from both sides of the equations?
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Christian Froeschlin wrote:
> SharkD wrote:
>
>> Unfortunately, this program uses algebraic functions in the format of
>> f(x) = 2 * x, which can sometimes be hard two convert to POVray's
>> format of 0 = 2 * x - y.
>
> I probably misunderstood that problem ... isn't the conversion just
> subtracting the function value from both sides of the equations?
In this case it is. However, consider the functions 0 = 2 * x - y^2 and
0 = 2 * x - log(y). Things begin to get a little tricky.
-Mike
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
SharkD wrote:
> Christian Froeschlin wrote:
>> SharkD wrote:
>>
>>> Unfortunately, this program uses algebraic functions in the format of
>>> f(x) = 2 * x, which can sometimes be hard two convert to POVray's
>>> format of 0 = 2 * x - y.
>>
>> I probably misunderstood that problem ... isn't the conversion just
>> subtracting the function value from both sides of the equations?
>
> In this case it is. However, consider the functions 0 = 2 * x - y^2 and
> 0 = 2 * x - log(y). Things begin to get a little tricky.
ok. I thought you wished to convert in the other direction.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
clipka wrote:
> SharkD schrieb:
>> The following function transforms a sphere such that it is expanded
>> logarithmically along the y axis. What I would like to do next is to
>> expand a sphere based on its distance from the origin instead. Any
>> ideas? Of course, if the sphere is located a the origin like my
>> example it will still look like a sphere.
>
> You'd need to (a) define the center of the sphere, (b) compute the
> desired radius from the distance to the origin, (c) redefine your
> Temp_fnc1 to take into account a radius, and (e) offset the parameters
> to Temp_fnc1 by the center, as in:
>
> #local Center = <...>; // (a)
> #local Radius = log(vlength(Center)+1) / log(2); // (b)
> #local Temp_fnc1 = function
> {
> 1 - min(1, sqrt(x*x + y*y + z*z)/Radius) // (c)
> }
> #local Temp_fnc3 = function
> {
> Temp_fnc1(x-Center.x,y-Center.y,z-Center.z) // (d)
> }
>
> I guess this definition for Temp_fnc3 might run into problems though,
> due to POV-Ray's general inability to use vector stuff in functions; you
> may need to define temporary variables for the Center vector components,
> as in:
>
> #local CenterX = Center.x;
> #local CenterY = Center.y;
> #local CenterZ = Center.z;
> #local Temp_fnc3 = function
> {
> Temp_fnc1(x-CenterX,y-CenterY,z-CenterZ)
> }
>
>
> Note that this will produce just a single sphere. To get multiples of
> them, you might want to add multiple instances of that function, as in:
>
> #macro Temp_Fnc(Center)
> #local Radius = log(vlength(Center)+1)
> #local Temp_fnc1 = function
> {
> 1 - min(1, sqrt(x*x + y*y + z*z)/Radius)
> }
> #local CenterX = Center.x;
> #local CenterY = Center.y;
> #local CenterZ = Center.z;
> ( Temp_fnc1(x-CenterX,y-CenterY,z-CenterZ) )
> #end
>
> #local Temp_fnc3 = function
> {
> Temp_Fnc(<0,1,0>) +
> Temp_Fnc(<0,3,0>) +
> Temp_Fnc(<0,10,0>) +
> ...
> }
I finally got around to trying this, and it didn't produce the results I
want. The main problem as I see it is that the Sphere parameter is
defined outside the function and stores only a single parameter.
-Mike
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|