POV-Ray : Newsgroups : povray.text.scene-files : 3D grapher for 1ternaut Server Time
31 Oct 2024 21:26:52 EDT (-0400)
  3D grapher for 1ternaut (Message 1 to 1 of 1)  
From: Shay
Subject: 3D grapher for 1ternaut
Date: 17 Jun 2004 13:57:07
Message: <40d1db73$1@news.povray.org>
// check out all of the documentation
// references for help

// adjust the Range, CamLoc, Start, End, and Step values
// as well as the #local statements and the conditional
// #if statement within the Plot_Location macro
// -Shay


// this is the include file containing the Reorient_Trans macro
#include "transforms.inc"

// how high an x, y or z value to display
// Range of one will show from -0.5 to +0.5
// Range of two will show from -1 to +1
// everything in the scene will be scaled by
// this number
#local Range = 100;

// make sure the camera is far enough away that it
// does not end up in the middle of your graph
#local CamLoc = <1000,2000,-10000>; // location of camera

#local Start = -100; // evaluate from here
#local End = 100; // to here
#local Step = 1; // increase values by this much between points


// **********************************************
// **********************************************
// **********************************************
// **********
// ********** macro to plot a point
// **********
// **********************************************
// **********************************************
// **********************************************

// Documentation 3.1.2.8.1
#macro Plot_Location ( TT )
 #local XX = TT;
 #local YY = TT;
 #local ZZ = TT;
 // Documentation 3.1.2.6.1
 #if ( mod ( TT, 2 ) = 0 & TT != 20) // if even and not = 20
  // Documentation 3.3.1.9
  sphere { < XX, YY, TT >, .01*Range
   pigment { rgb <0,1,0> }
   finish { ambient .5 }
  }
 #end
#end

// **********************************************
// **********************************************
// **********************************************
// **********
// ********** send as many values to macro as
// ********** you like
// **********
// **********************************************
// **********************************************
// **********************************************


// Documentation 3.1.2.6.4
#local TT = Start;
#while ( TT <= End )
 Plot_Location ( TT )
#local TT = TT + Step;
#end

// **********************************************
// **********************************************
// **********************************************
// **********
// ********** set up the camera and light source
// **********
// **********************************************
// **********************************************
// **********************************************


// Documentation 3.2.2.2.2
camera {
 orthographic
 location CamLoc
 look_at  <0,0,0>
 right Range*1.1*3/2*x // large enough to show graph + axis label
 up Range*1.1*y // large enough to show graph + axis label
}

// Documentation 3.3.7.1
light_source {
 <25, 25, 25>
 rgb 1
}

// Documentation 3.2.3.2
background { rgb 1 }


// **********************************************
// **********************************************
// **********************************************
// **********
// ********** show x, y, and z axis (axiis? )
// **********
// **********************************************
// **********************************************
// **********************************************

// Documentation 3.3.1.4
cylinder { <-Range/2,0,0>, <Range/2,0,0>, .005*Range
 pigment { rgb 0 }
}
cylinder { <0,-Range/2,0>, <0,Range/2,0>, .005*Range
 pigment { rgb 0 }
}
cylinder { <0,0,-Range/2>, <0,0,Range/2>, .005*Range
 pigment { rgb 0 }
}

// Documentation 3.3.1.13
text { ttf "crystal.ttf", "X", 2, 0
 scale Range/10
 Reorient_Trans(<0,0,-1>, CamLoc)
 translate <Range/2,0,0>
 pigment { rgb <1,.25,0> }
 finish { ambient 1 }
}
text { ttf "crystal.ttf", "Y", 2, 0
 scale Range/10
 Reorient_Trans(<0,0,-1>, CamLoc)
 translate <0,Range/2,0>
 pigment { rgb <1,.25,0> }
 finish { ambient 1 }
}
text { ttf "crystal.ttf", "Z", 2, 0
 scale Range/10
 Reorient_Trans(<0,0,-1>, CamLoc)
 translate <0,0,Range/2>
 pigment { rgb <1,.25,0> }
 finish { ambient 1 }
}


Post a reply to this message

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