POV-Ray : Newsgroups : povray.text.scene-files : Final Twyst (No hole in the middle) Server Time
1 Nov 2024 15:25:26 EDT (-0400)
  Final Twyst (No hole in the middle) (Message 1 to 2 of 2)  
From: Larry Fontaine
Subject: Final Twyst (No hole in the middle)
Date: 15 Sep 1999 00:00:39
Message: <37DF1826.65DB629A@isd.net>
//Added a prism to the middle to eliminate that hole in the center of
it.

//The spike macro:
//  twyst(1,2,3,4,5,6,7)
//  1 = Points array, dim. [#points][2]
//  2 = Height of spike
//  3 = Rotation between two layers
//  4 = Radius of rounded edge at base
//  5 = Spacing ratio (should be almost 1)
//      formula is height = (1-pow(Ratio,Layer))*Height
//  6 = Number of layers, not enough will cut the spike short
//         because of the spacing ratio
//  7 = color difference between layers
//        rainbow cycles every mult. of 3
#macro twyst(Points,Height,Rot,Rad,Rat,Num,Clr)
#local Nctr = 0;
#local RecH = 0;     //RecH = current layer's height
#local RecR = -Rot;  //RecR = current layer's rotation
#local Scale = 1;    //Scale = scale factor for current layer
#local Color = (clock*3);    //stores 0-3 indicating rainbow position
#local numpoints = dimension_size(Points,1);
union {
 #while (Nctr < Num)   //Layer counter
  #local RecR = RecR+Rot; //increase rotation
  #local Rctr = 0;
  #local Color = mod(Color+Clr,3);
  #local CTemp = mod(Color,1);
  #declare Vary = color rgb<0,1-CTemp,CTemp>;  //rainbow colors
  #if (Color < 2) #declare Vary = color rgb<1-CTemp,CTemp,0>; #end
  #if (Color < 1) #declare Vary = color rgb<CTemp,0,1-CTemp>; #end
  // here you can average Vary with other colors
  #declare Vary = color Vary*.5+SkyBlue*.3+Gray95*.2;
  #while (Rctr < numpoints)  //points counter
   cylinder { < Points[Rctr][0], 0, Points[Rctr][1] >,
              < Points[mod(Rctr+1,numpoints)][0], 0,
                Points[mod(Rctr+1,numpoints)][1] >, Rad
              rotate RecR*y scale Scale
              translate RecH*y pigment { Vary }
              finish { specular .9 roughness .005 } }
   sphere { < Points[Rctr][0], 0, Points[Rctr][1] >, Rad
              rotate RecR*y scale Scale
              translate RecH*y pigment { Vary }
              finish { specular .9 roughness .005 } }
   #local Rctr = Rctr + 1;
  #end
  #local Rctr = 0;
  prism { -Rad,Rad,numpoints+1
  #while (Rctr < numpoints)  //points counter
   <Points[Rctr][0],Points[Rctr][1]>,
   #local Rctr = Rctr + 1;
  #end
  <Points[0][0],Points[0][1]>
    rotate RecR*y scale Scale
    translate RecH*y pigment { Vary }
    finish { specular .9 roughness .005 } }
  #local RecH = Height-RecH;  //adjust RecH for next layer
  #local RecH = RecH*Rat;
  #local Scale = RecH/Height; //adjust scale for next layer
  #local RecH = Height-RecH;
  #local Nctr = Nctr + 1;
 #end
} #end


Post a reply to this message

From: Ian Burgmyer
Subject: Re: Final Twyst (No hole in the middle)
Date: 17 Sep 1999 21:16:48
Message: <37e2e800@news.povray.org>
*drool*  Umm. . .where's the huge electric sho*ZZZZAAAAAPPPPPPPP!!!!!!*

Ow.

-Kentucky Fried Ian

Larry Fontaine <lfo### [at] isdnet> wrote in message
news:37DF1826.65DB629A@isd.net...
> file://Added a prism to the middle to eliminate that hole in the center of
> it.
>
> file://The spike macro:
> //  twyst(1,2,3,4,5,6,7)
> //  1 = Points array, dim. [#points][2]
> //  2 = Height of spike
> //  3 = Rotation between two layers
> //  4 = Radius of rounded edge at base
> //  5 = Spacing ratio (should be almost 1)
> //      formula is height = (1-pow(Ratio,Layer))*Height
> //  6 = Number of layers, not enough will cut the spike short
> //         because of the spacing ratio
> //  7 = color difference between layers
> //        rainbow cycles every mult. of 3
> #macro twyst(Points,Height,Rot,Rad,Rat,Num,Clr)
> #local Nctr = 0;
> #local RecH = 0;     file://RecH = current layer's height
> #local RecR = -Rot;  file://RecR = current layer's rotation
> #local Scale = 1;    file://Scale = scale factor for current layer
> #local Color = (clock*3);    file://stores 0-3 indicating rainbow position
> #local numpoints = dimension_size(Points,1);
> union {
>  #while (Nctr < Num)   file://Layer counter
>   #local RecR = RecR+Rot; file://increase rotation
>   #local Rctr = 0;
>   #local Color = mod(Color+Clr,3);
>   #local CTemp = mod(Color,1);
>   #declare Vary = color rgb<0,1-CTemp,CTemp>;  file://rainbow colors
>   #if (Color < 2) #declare Vary = color rgb<1-CTemp,CTemp,0>; #end
>   #if (Color < 1) #declare Vary = color rgb<CTemp,0,1-CTemp>; #end
>   // here you can average Vary with other colors
>   #declare Vary = color Vary*.5+SkyBlue*.3+Gray95*.2;
>   #while (Rctr < numpoints)  file://points counter
>    cylinder { < Points[Rctr][0], 0, Points[Rctr][1] >,
>               < Points[mod(Rctr+1,numpoints)][0], 0,
>                 Points[mod(Rctr+1,numpoints)][1] >, Rad
>               rotate RecR*y scale Scale
>               translate RecH*y pigment { Vary }
>               finish { specular .9 roughness .005 } }
>    sphere { < Points[Rctr][0], 0, Points[Rctr][1] >, Rad
>               rotate RecR*y scale Scale
>               translate RecH*y pigment { Vary }
>               finish { specular .9 roughness .005 } }
>    #local Rctr = Rctr + 1;
>   #end
>   #local Rctr = 0;
>   prism { -Rad,Rad,numpoints+1
>   #while (Rctr < numpoints)  file://points counter
>    <Points[Rctr][0],Points[Rctr][1]>,
>    #local Rctr = Rctr + 1;
>   #end
>   <Points[0][0],Points[0][1]>
>     rotate RecR*y scale Scale
>     translate RecH*y pigment { Vary }
>     finish { specular .9 roughness .005 } }
>   #local RecH = Height-RecH;  file://adjust RecH for next layer
>   #local RecH = RecH*Rat;
>   #local Scale = RecH/Height; file://adjust scale for next layer
>   #local RecH = Height-RecH;
>   #local Nctr = Nctr + 1;
>  #end
> } #end
>
>


Post a reply to this message

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