POV-Ray : Newsgroups : povray.binaries.scene-files : Prisms for David Vincent-Jones : Prisms for David Vincent-Jones Server Time
2 Sep 2024 16:20:31 EDT (-0400)
  Prisms for David Vincent-Jones  
From: David Wilkinson
Date: 2 Oct 2000 07:53:56
Message: <13tgtscaohf63c4qvdulgtm26vs0op7jtc@4ax.com>
/*  This is in response to a posting by David Vincent-Jones in p.a-u
It is a couple of macros that allow a succession of prisms to be defined from
sets of data points */

// Persistence of Vision Ray Tracer Scene Description File
// File: Prisms.pov
// Vers: 3.1
// Date: 2 October 2000
// Auth: D.G.Wilkinson <dav### [at] hamiltonitecom> <http://hamiltonite.com>

#version 3.1;
#include "colors.inc"
global_settings { assumed_gamma 1 }
camera {
  location  <0.0, 3, -5>
  direction 1.5*z
  right     4/3*x
  look_at   <2, 1,  0.0>
}
light_source { <-20, 10, -50>  color rgb 1 }
light_source { <20, 10, -50>  color rgb 1 } 

#declare DATA = array [11]  // size the array to suit the data

#macro  DataReset()
   #declare DATA[0] =  <0,0>;
   #declare DATA[1] =  <0,0>;
   #declare DATA[2] =  <0,0>;
   #declare DATA[3] =  <0,0>;
   #declare DATA[4] =  <0,0>;
   #declare DATA[5] =  <0,0>;
   #declare DATA[6] =  <0,0>;
   #declare DATA[7] =  <0,0>;
   #declare DATA[8] =  <0,0>;
   #declare DATA[9] =  <0,0>;
   #declare DATA[10] =  <0,0>;
#end

#macro Prism1 (Depth)
#declare Nums=10;  // max subscript in array
#while (vlength(DATA[Nums])<0.001) #declare Nums=Nums-1; #end
#declare Nums=Nums+1;
#local Count = 0;  
       prism{ linear_sweep linear_spline 0,Depth,Nums+1,
       #while (Count<Nums) DATA[Count] #declare Count=Count+1; #end
       DATA[0]    // close the prism with the first data point
       }
#end
  
// Essential to reset the Data points to zero
DataReset()

// These are the data points in the prism  - only define the ones you need,
//  no need to repeat the first point as this is done in the macro
   #declare DATA[0] =  <0,0>;
   #declare DATA[1] =  <1,0>;
   #declare DATA[2] =  <1,1>;
   #declare DATA[3] =  <0,2>;

// draw the 1st prism
object  {
         Prism1(1)
         pigment{color Red}
        }

DataReset()

   #declare DATA[0] =  <0,0>;
   #declare DATA[1] =  <1,1>;
   #declare DATA[2] =  <2,1.5>;
   #declare DATA[3] =  <1,2>;
   #declare DATA[4] =  <-.5,1>;
   
// draw the 2nd prism
object  {
         Prism1(1.5)
         pigment{color Blue}
         translate 2*x
        }  
            
//****** end of file *****
----------------------
dav### [at] hamiltonitecom
http://hamiltonite.com/


Post a reply to this message

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