POV-Ray : Newsgroups : povray.general : how to make a revolution plot from a parametric function? : Re: how to make a revolution plot from a parametric function? Server Time
8 Jul 2024 13:38:52 EDT (-0400)
  Re: how to make a revolution plot from a parametric function?  
From: JimT
Date: 5 Jun 2014 03:40:00
Message: <web.53901d8135ccce6fbe7517870@news.povray.org>
> Is it possible to create a revolution plot directly from a parametric function?
>
> For example, I have a 2d parametric function
>
> x[u]=Cos[u]*(1 + 2 Cos[2 u])
> y[u]=Sin[u]*(1+2Cos[2 u])
>
In this case, yes.

Since x = rcos(theta) and y = rsin(theta) in standard polars, your parametric
equations are just saying
r   = 1+2cos(2theta)
    = 1+2cos^2(theta)-2sin^2(2theta)
    = 3cos^2(theta) - sin^2(2theta)
    = (3x^2 - y^2)/r^2
r^3 = (3x^2 - y^2)
Square to pick up the negative r lobes
r^6 = (3x^2 - y^2)^2
In 2D
(x^2+y^2)^3 = (3x^2 - y^2)^2
To go to 3D, to be axi-symmetric around the x axis, replace y^2 with y^2+z^2.
Replacing x^2 by x^2+z^2 would be axi-symmetric around the y axis. A similar
shape, but the large lobe rotates to a "disk".

#include "colors.inc"

#declare surftest =
isosurface {
 function { pow(x*x+y*y+z*z,3)-pow(3*x*x-y*y-z*z,2)}
// evaluate 356*Min_factor,  sqrt(356/(356*Min_factor)),  0.7
 max_gradient 1500
 all_intersections
 contained_by { sphere { 0 3}}
 clipped_by {box {-3 3}}
 pigment {Red}
 finish { phong 0.6 reflection 0.2 }
}
object{surftest }
background{White}
light_source { <20,20,20> color 1}
camera{location <0, 0, 20> look_at <0, 0, 0> angle 40}

Produces the surface.Note the rather large max_gradient. For a while, with
smaller max_gradient, I wasn't getting anything.

Thanks,

JimT


Post a reply to this message

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