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:19:02 EST (-0500)
  Re: Spherical Products With Other Polar Functions [40 k]  
From: Mike Williams
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

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