POV-Ray : Newsgroups : povray.general : Flower power : Re: Flower power Server Time
4 Aug 2024 02:20:55 EDT (-0400)
  Re: Flower power  
From: Patrick Elliott
Date: 23 Oct 2003 17:31:02
Message: <MPG.1a01f4943b4461b8989906@news.povray.org>
In article <KwnOiDA022l$EwP5@econym.demon.co.uk>, 
nos### [at] econymdemoncouk says...
> Wasn't it Patrick Elliott who wrote:
> 
> >In my case I am trying to do something like:
> >
> >N = 5 * rnd
> >vdelta = 2 * PI * rnd
> >vector = a * sin(N * vdelta)
> >X = cos(vector) * 30 
> >Y = sin(vector) * 30
> >
> >The problem is all I get is a dang circle... It is driving me batty. If 
> >it was for something in POV, it would be driving me even more nuts. But 
> >man would the StarrRose make a real nice Isosurface. Sigh...
> 
> I think that N should be a constant (it's the number of petals or half
> the number of petals depending on whether it's odd or even) and X and Y
> should be cos(vdelta)*vector and sin(vdelta)*vector. "a" is a scaling
> factor, the maximum radius of the whole shape
> 
> So:-
> 
> #version 3.5;
> global_settings {assumed_gamma 1.0}
> camera {location  <0,0,-10> look_at <0,0,0> angle 50}
> background {rgb 1}
> light_source {<-30, 100, -30> color rgb 1}
> 
> #declare rnd=0;
> #declare N = 5;
> #declare a=3;
> #while (rnd < 1)
>   #declare vdelta = 2 * pi * rnd;
>   #declare vector = a * sin(N * vdelta);
>   #declare X = cos(vdelta) * vector; 
>   #declare Y = sin(vdelta) * vector;
>     sphere {<X,Y,0>,0.2 pigment {rgb <1,1,0>}}
>   #declare rnd = rnd + 0.001;
> #end
Heh! That works. Was screwed up on the correct way to convert polar to 
rectangular. :p

> 
> If we bung the significant bit "vector = a * sin(N * vdelta)" into an
> isosurface it looks like this "a * sin(N * f_th(x,z,y))", which doesn't
> do anything useful on it's own but suggests something like this:-
> 
> #version 3.5;
> global_settings {assumed_gamma 1.0}
> camera { location  <-1, 1, -6> look_at <0, 0, 0> angle 50}
> background {rgb 1}
> light_source {<-30, 100, -30> color rgb 1}
> #include "functions.inc"
> 
> #declare n = 5;
> #declare a = 2;
> isosurface {
>   function { a * sin(n*f_th(x,z,y)) * f_sphere(x,y,z,a) + 0.1}
>   max_gradient 20
>   contained_by{sphere{0,a}}
>   pigment {rgb .9}
>   finish {phong 0.5 phong_size 10}
> }
> 
Yeah. I wondered about shoe horning a useful Z axis into that. The 
StarrRose uses a, b and c as scales, which I think implies it already 
accounts for z, but lacking the equations to define how those are used... 
:p

Like I said though, my own problem wasn't for use in POV, I just thought 
I would ask about it, since the two things are closely related, at least 
with respect to the basic equations. I am actually designing an ActiveX 
control that generates a 2D firework. The X and Y are used as velocity 
vectors so that all the points starts at a central position and drift 
outward, losing X velocity slightly and gaining Y velocity towards the 
ground with each time is draws. Works nice for stuff I could make work 
right, but I completely missed the obvious fact that with X = cos(Delta) 
* r and Y = sin(Delta) * r, r was actually what I had as 'vector'. 
Sigh... Shows you how much I know about math..

However, I stand by the statement that, as a reference sight for 
equations, the fact that this site seem to be the 'only' one with a 
decent list doesn't mean it is a complete or accurate one. I would love 
to actually know how they got that StarrRose. :(

-- 
void main () {

    call functional_code()
  else
    call crash_windows();
}


Post a reply to this message

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