POV-Ray : Newsgroups : povray.binaries.images : Spherical Products With Other Polar Functions [40 k] : Re: Spherical Products With Other Polar Functions [40 k] Server Time
15 Nov 2024 10:17:19 EST (-0500)
  Re: Spherical Products With Other Polar Functions [40 k]  
From: Dave Matthews
Date: 19 Jul 2003 21:20:01
Message: <web.3f19ebee733ff5dd7196f5900@news.povray.org>
Mike Williams wrote:

>Nice.
>
>One tiny change to make life a little easier would be to #declare the
>r_1 and r_2 functions, so that when you want to experiment with
>different functions you only need to change them once.
>
>// Change these lines to try different shapes
>#declare r_1 = function(u,v){cos(3*u)}
>#declare r_2 = function(u,v){sin(2*v)}
>
>// Leave these lines alone
>#declare F1= function(u,v){r_1(u,v)*cos(u) *r_2(u,v)*cos(v)}
>#declare F2= function(u,v){r_1(u,v)*sin(u) *r_2(u,v)*cos(v)}
>#declare F3= function(u,v){r_2(u,v)*sin(v)}
>
>Mike Williams
>Gentleman of Leisure
>

Thanks.

In fact, I tried to do that, but I had something goofed up on my syntax.  I
still have a mental block about declaring and using functions, and I don't
know why, since they're just like they are in math, and I use them there
every day.

A second thing I forgot to mention, is that if you are using uv_mapping, you
must make sure to only create the surface once.  In my example, for
example, u should only go from 0 to pi, while v goes from 0 to 2pi.

This determination is a bit more complicated than it first appears.

If r_1 and r_2 were non-negative, -pi/2 < v < pi/2 would always suffice.
But the above example shows this is not the case in general.

Since r_1(t) = cos ( 3t ) is created from 0 to pi, then repeated (on the
plane) and r_2(t) = sin ( 2t ) is created from 0 to 2pi, you might guess
that you simply limit your domain to what would create one copy of each, in
the plane.  This works, in the above example, and in the example:

r_1(u) = cos(u) + 0.5 and r_2(v) = sin (v) + 0.5.  Here each (u and v) must
go from 0 to 2pi.

It also works with:

r_1= r_2=cos(3t), which is created by letting u and v each go from 0 to pi.

However, due to symmetry, if you let

r_1 = r_2 = cos(2t),

the correct domain is 0 < u < pi, 0 < v < 2pi.

It is true that you need never increase the domains of u and v beyond what
would create one copy of the plane curve (since you can think of the surface
as being created by applying r_2 to the generator r_1(u) and vice-versa.)

I had to make animations to figure out how the complications arose (it also
showed me where the "extra" 3 petals come from in what is, on the plane, a
3 - petal rose, r = cos (3t), when r_1 =cos(3u) and r_2=cos (2v), and why
they disappear when the product is reversed. . . .)

Dave Matthews


Post a reply to this message

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