|
![](/i/fill.gif) |
> "JimT" <nomail@nomail> wrote:
>>> 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
>
> Thanks. That's very helpful.
> But can we get the most outer surface of the plot? I mean can we make the
> surface into a single solid object without all the internal structures?
> And what does this line mean "evaluate 356*Min_factor,
> sqrt(356/(356*Min_factor)), 0.7" ?
>
>
"evaluate 356*Min_factor, sqrt(356/(356*Min_factor)), 0.7" is an
alternate manner to account for the max_gradient value of your function.
In effect, it allow the used max_gradient do dynamicaly change during
the trace within some limits.
The first value is a starting gradient value. It should be somewhat
smaller than the found max_gradient.
The second value is a ovder-evaluation factor. It controll how fast the
gradient used is allowed to increase. This value must be larger than 1.
It can be simplified as sqrt(1/Min_factor)
Lastly, is the under-evaluation factor controlling how fast the gradient
is allowed to fall. "0.7" is a good starting value.
After rendering without setting max_gradient, you take note of the found
max_gradient from the message window (for the Windows and Mac versions,
messages stream on Linux).
You use that value in place of the "356" of that example.
It's very usefull when you have several isosurfaces placed with a #while
loop, using slight variations, variously scalled, rotated and translated
and you have messages for both to large AND to small max_gradient values
at the same time...
Alain
Post a reply to this message
|
![](/i/fill.gif) |