|
|
Here is a blank for a parametric object include file:
// Parametric variable form
#declare uMin = 0; // Minimum u value
#declare uMax = pi; // Maximum u value
#declare uNum = 45; // Number of points in u direction
#declare uWrap = 0; // u wraps around if != 0
#declare uSeed = 7335; // Random number seed for u parameter
#declare vMin = 0; // Minimum v value
#declare vMax = radians(359); // Maximum v value
#declare vNum = 360; // Number of points in v direction
#declare vWrap = 1; // v wraps around if != 0
#declare vSeed = 2252; // Random number seed for v parameter
#declare IsRnd = true; // True if random number used
#declare IsUV = false; // True if object is to be UV-mapped
#declare Smooth = 0; // Smooth flag
#declare Detail = "Partial"
/* Detail values
Verbose = Line by line details
Partial = Operations only
Other = Filename only
*/
/* For all macro functions
i = Current value of u parameter
j = Current value of v parameter
p = Current value of u variance (0...1)
q = Current value of v variance (0...1)
vc= Current 3D point
*/
// Optional variables and subfunctions
// point function
#macro pnt(i, j, p, q)
#local xp = sin(i)*cos(j);
#local yp = pow(cos(i)+1, 2);
#local zp = sin(i)*sin(j);
#local pt0 = <xp,yp,zp>*(1+0.1*q);
pt0
#end
How would a rose be defined using this format? The include file may contain
#declare and #local variables as well as other #macros.
"Dave Matthews" <dma### [at] wrmnwestmnscuedu> wrote in message
news:web.3f9927d7a022f3b88062416c0@news.povray.org...
> Mike Williams wrote:
> >Wasn't it Patrick Elliott who wrote:
> >
> >> I would love to actually know how they got that StarrRose. :(
> >
> >If you feel strongly enough about it to go out and buy the book that
> >they got the equation from, then perhaps you could let us know.
> >
> >Mike Williams
> >Gentleman of Leisure
> >
> No need, someone already has the book.
>
> What's going on here is a simple parametric curve, "doctored up" to look
3D.
> But we can do something similar in PovRay.
>
> The radius varies according to a set function: 2 + sin(At)/2, creating an
> "opened-up" rose.
>
> The twist is that the angle, rather than simply proceeding
counter-clockwise
> around the circle, backs up on itself, NewT = t + Sin(Bt)/C, so that we
> have the modified parametric equations:
>
> x = r(t)cos(NewT), y = r(t)sin(NewT).
>
> All of the shading is done by connecting the origin to the edge of the
> curve, then shrinking and superimposing repeated copies of the image on
> itself.
>
> We can get one version of this by letting the vertical (y) component vary
> according to r(t).
>
> //Starr Rose For PovRay
>
> #version 3.5;
>
> #global_settings { assumed_gamma 1.0 }
>
> camera { angle 50
> right x*image_width/image_height
> location <0, 50, 0>
> look_at <0, 0, 0>
> }
>
> light_source { <800, 1200, -500> color rgb <1, 1, 1> }
>
> #macro Starr_Rose(A, B, C, N)
>
> #local Radius= function(Theta) {2 + sin(A*Theta)/2}
> #local AngleShift = function(Theta) {sin(B*Theta)/C}
>
> #local Angle = 0;
>
> #local Cycle = 2*pi;
> union {
> #while (Angle <= Cycle)
> #local X = Radius(Angle)*cos(Angle + AngleShift(Angle));
> #local Z = Radius(Angle)*sin(Angle + AngleShift(Angle));
> #local Y = 2 - Radius(Angle) ;
> cylinder { <0, 0, 0>, <X, Y, Z>, 0.05 }
>
> #local Angle = Angle + Cycle/N;
>
> #end
> }
> #end
>
>
>
> object { Starr_Rose(6, 18, 18, 500) texture { pigment { color rgb <1, 0,
0>
> } }
> scale 5}
>
> /////////////////End of Code
>
> I'm guessing that one of you with more experience at POVRay can do up a
> better version, but this gives the idea.
>
Post a reply to this message
|
|