POV-Ray : Newsgroups : povray.newusers : How, spline-datas in an array ? : How, spline-datas in an array ? Server Time
29 Jul 2024 06:20:47 EDT (-0400)
  How, spline-datas in an array ?  
From: Meothuru
Date: 23 May 2006 01:50:01
Message: <web.4472a196f9ef9e2b5ab9a06d0@news.povray.org>
Hi folks,

in the following script, the stellar constellation
of "Orion" is drawn by 3 spline-objects.As you can
see, the while-loops are absolut identical.

Is it possible to define the spline-coordinates in
a two-dimensional array and let draw the figure by
one extended loop ?

btw.
Sorry for my english (it's not my mother language),
I hope, you can understand what I mean. And please
can you give me a litte example, how I can define
an array..if it's possible ?

Thank You for your help


// spline-model:
// stellar constellation of "Orion"

#include "colors.inc"
#include "textures.inc"

global_settings { assumed_gamma 1.5 }

background {Black}
light_source{<0,3,-7>, White*1.7}

camera {
  location <0, 3, -7>
  look_at <0, 2, 10>
}

union {
   #declare orion=spline{
   linear_spline
   1,<-1.32,3.42 ,1>,
   2,<-1.63,3.76,1>,
   3,<-2.07,4.65,1>,
   4,<-1.95,5.6,1>,
   5,<-2.07,4.65,1>,
   6,<-1.83,4.71,1>,
   7,<-1.56,5.55,1>,
   8,<-1.56,5.55,1>
   }

   #declare X=0;
   #while (X< 8)
     sphere {<0,0,0>, 0.05
       pigment{Red}
       finish {Phong_Glossy}
       translate orion(X)
     }
     #declare X=X+0.0005;
   #end

   #declare orion=spline{
   linear_spline
   1,<.17,3.15,1>,
   2,<2.02, 3.15,1>,
   3,<2.015, 3.46,1>
   4,<1.79, 3.69, 1>
   5,<2.015, 3.46,1>
   6,<2.02, 3.15,1>,
   7,<1.75, 2.4,1>,
   8,<1.5, 2.3,1>
   }

   #declare X=0;
   #while (X< 8)
     sphere {<0,0,0>, 0.05
       pigment{Red}
       finish {Phong_Glossy}
       translate orion(X)
     }
     #declare X=X+0.0005;
   #end

 #declare orion=spline{
   linear_spline
   1,<-1.3,0.5,1>,
   2,<0.45,0.65,1>,
   3,<-0.31,2.03, 1>,
   4,<.17,3.15,1>,
   5,<-0.31,3.75,1>,
   6,<-1.32,3.42 ,1>,
   7,<-0.79,1.82,1>
   8,<-1.3,0.5,1>
   }

   #declare X=0;
   #while (X< 8)
     sphere {<0,0,0>, 0.05
       pigment{Red}
       finish {Phong_Glossy}
       translate orion(X)
     }
     #declare X=X+0.0005;
   #end
}

// EOF


Post a reply to this message

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