POV-Ray : Newsgroups : povray.binaries.images : Spherical Products With Other Polar Functions [40 k] Server Time
16 Nov 2024 06:16:32 EST (-0500)
  Spherical Products With Other Polar Functions [40 k] (Message 1 to 3 of 3)  
From: David Matthews
Subject: Spherical Products With Other Polar Functions [40 k]
Date: 18 Jul 2003 22:59:28
Message: <3F18B415.6010606@dinecollege.edu>
Thanks to the recent posting by Paul Bourke regarding super shapes 
extended to 3D via spherical products, 


http://members.home.nl/seedseven/, I put together something for my (fall 
semester) multi-variable calculus students, generalizing from super 
shapes to other polar curves.  I thought some POVRay users might be 
interested,  at least in the results.  A fun evening can be had by 
digging out an old analytic geometry book, or other source of polar 
curves, and crossing different famous curves in different orders (at 

POVRay users, but my students will be learning POVRay as we go, and thus 
be pretty much as ignorant as I am, regarding POVRay.  I did, at least, 
clip out the reminders about how to use .inc files and such.)

Spherical Products and Polar Functions:

The spherical product of two parametrically-defined planar curves, 
H(h_x(u), h_y(u)) and M(m_x(v), m_y(v)), is defined by (H * M)(u, v) via:
	x(u, v) = h_x(u)m_x(v)
	y(u, v) = h_y(u)m_x(v)
	z(u, v) = m_y(v)

(I use underscores, when I can't subscript.)

Note that about half the sources I looked up defined the product in the 

important to know which order a particular source is using!

Since every planar polar function can also be described via the 
canonical parameterization :  x = r(t)cos(t), 	y = r(t)sin(t), one can 
form the spherical product of any two polar functions, r_1(u) and r_2(v):

r_1 * r_2 (or r_2 * r_1 for the alternate definition) via:	

x(u, v) = r_1(u)cos(u)r_2(v)cos(v)
y(u, v) = r_1(u)sin(u)r_2(v)cos(v)
z(u, v) = r_2(v)sin(v)

To render these objects in a left-hand coordinate system (such as 
POVRay) and achieve the same pictures as with Mathematica or Maple, 
interchange the roles of y and z (as below, where F3 applies to the y 
component.)



r_1(u) = cos(3u) and r_2(v) = sin(2v):

#declare F1= function(u,v){cos(3*u)*cos(u)*sin(2*v)*cos(v)}
#declare F2= function(u,v){cos(3*u)*sin(u)*sin (2*v)*cos(v)}
#declare F3= function(u,v){sin(2*v)*sin(v)}

object{
    Parametric(
       F1, F3, F2,
       <FromU(0), FromV(0)>, <ToU(2*pi), ToV(2*pi)>,
       150,150,"C_3UxS_2V.inc"
    )
  [ object_modifiers ]
}

The parameters in "Parametric" are described in the #include files.

Here are 3 examples:

(Truth-In-Advertising Disclaimer:  The stem on the psychedelic flower is 
a sphere_sweep, and not a part of the product.  The captions were added 
in Photoshop.)


Post a reply to this message


Attachments:
Download 'polarspsjpg.jpg' (28 KB)

Preview of image 'polarspsjpg.jpg'
polarspsjpg.jpg


 

From: Mike Williams
Subject: Re: Spherical Products With Other Polar Functions [40 k]
Date: 19 Jul 2003 11:14:01
Message: <GmgtXKAn4QG$Ew38@econym.demon.co.uk>
Wasn't it David Matthews who wrote:
>Thanks to the recent posting by Paul Bourke regarding super shapes 
>extended to 3D via spherical products, 


>http://members.home.nl/seedseven/, I put together something for my (fall 
>semester) multi-variable calculus students, generalizing from super 
>shapes to other polar curves.  I thought some POVRay users might be 
>interested,  at least in the results.  A fun evening can be had by 
>digging out an old analytic geometry book, or other source of polar 
>curves, and crossing different famous curves in different orders (at 

>POVRay users, but my students will be learning POVRay as we go, and thus 
>be pretty much as ignorant as I am, regarding POVRay.  I did, at least, 
>clip out the reminders about how to use .inc files and such.)
>
>Spherical Products and Polar Functions:
>
>The spherical product of two parametrically-defined planar curves, 
>H(h_x(u), h_y(u)) and M(m_x(v), m_y(v)), is defined by (H * M)(u, v) via:
>       x(u, v) = h_x(u)m_x(v)
>       y(u, v) = h_y(u)m_x(v)
>       z(u, v) = m_y(v)
>
>(I use underscores, when I can't subscript.)
>
>Note that about half the sources I looked up defined the product in the 

>important to know which order a particular source is using!
>
>Since every planar polar function can also be described via the 
>canonical parameterization :  x = r(t)cos(t),  y = r(t)sin(t), one can 
>form the spherical product of any two polar functions, r_1(u) and r_2(v):
>
>r_1 * r_2 (or r_2 * r_1 for the alternate definition) via:     
>
>x(u, v) = r_1(u)cos(u)r_2(v)cos(v)
>y(u, v) = r_1(u)sin(u)r_2(v)cos(v)
>z(u, v) = r_2(v)sin(v)
>
>To render these objects in a left-hand coordinate system (such as 
>POVRay) and achieve the same pictures as with Mathematica or Maple, 
>interchange the roles of y and z (as below, where F3 applies to the y 
>component.)
>

>
>r_1(u) = cos(3u) and r_2(v) = sin(2v):
>
>#declare F1= function(u,v){cos(3*u)*cos(u)*sin(2*v)*cos(v)}
>#declare F2= function(u,v){cos(3*u)*sin(u)*sin (2*v)*cos(v)}
>#declare F3= function(u,v){sin(2*v)*sin(v)}
>
>object{
>    Parametric(
>       F1, F3, F2,
>       <FromU(0), FromV(0)>, <ToU(2*pi), ToV(2*pi)>,
>       150,150,"C_3UxS_2V.inc"
>    )
>  [ object_modifiers ]
>}
>
>The parameters in "Parametric" are described in the #include files.

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


Post a reply to this message

From: Dave Matthews
Subject: Re: Spherical Products With Other Polar Functions [40 k]
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.