POV-Ray : Newsgroups : povray.text.scene-files : Parametric object Server Time
1 Nov 2024 01:21:47 EDT (-0400)
  Parametric object (Message 1 to 1 of 1)  
From: Florian Brucker
Subject: Parametric object
Date: 9 Jan 2003 11:04:53
Message: <3e1d9da5$1@news.povray.org>
/*
Parametric Object
Author: Florian Brucker
tor### [at] torfboldcom
http://www.torfbold.com

you can do with this what you like...
have fun
*/

background { rgb 1 }

camera {
 location <80,20,-80>
 look_at y*40
}

global_settings {
 max_trace_level 256
}

light_source { <1,1,-1>*1000 rgb 1 }

#declare MyFuncX = function (time) { sin(time*pi)*5 }    //X-Coordinates
#declare MyFuncY = function (time) { time*10 }
//Y-Coordinates
#declare MyFuncZ = function (time) { time*time*time*time*time*0.01 }
//Z-Coordinates
#declare MyFuncR = function (time) { sin(time*time*time*0.1)+1 }    //Radius

#macro MyMacroP(time) //Pigment
 rgb<1-(time+5)/10,0.5,(time+5)/10> transmit ((time+5)/10) filter
(1-(time+5)/10)
#end


#declare EvalStart = -5;
#declare EvalEnd = 5;
#declare Steps = 700;
#declare Delta = 1/Steps*abs(EvalEnd-EvalStart);

union {
 #local a = 0;
 sphere {

<MyFuncX(EvalStart+a*Delta),MyFuncY(EvalStart+a*Delta),MyFuncZ(EvalStart+a*D
elta)>,MyFuncR(EvalStart+(a+0.5)*Delta)
  pigment {  MyMacroP(EvalStart+(a+0.5)*Delta) }
 }
 #while (a<Steps-1)
  #declare P1 =
<MyFuncX(EvalStart+a*Delta),MyFuncY(EvalStart+a*Delta),MyFuncZ(EvalStart+a*D
elta)>;
  #declare P2 =
<MyFuncX(EvalStart+(a+1)*Delta),MyFuncY(EvalStart+(a+1)*Delta),MyFuncZ(EvalS
tart+(a+1)*Delta)>;
  #declare Radius = MyFuncR(EvalStart+(a+0.5)*Delta);  //evtl.
MyFuncR(EvalStart+(a+0.5)*Delta);
  cylinder {
   P1,P2,Radius
   pigment {  MyMacroP(EvalStart+(a+0.5)*Delta) }
  }

  #local a = a + 1;
 #end
 sphere {

<MyFuncX(EvalStart+a*Delta),MyFuncY(EvalStart+a*Delta),MyFuncZ(EvalStart+a*D
elta)>,MyFuncR(EvalStart+(a+0.5)*Delta)
  pigment {  MyMacroP(EvalStart+(a+0.5)*Delta) }
 }

 translate y*-MyFuncY(EvalStart)
}


Post a reply to this message

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