diff -Naur gnuplot-4.0.0/src/plot2d.c gnuplot-4.0.0_povrml/src/plot2d.c
--- gnuplot-4.0.0/src/plot2d.c	2004-04-14 02:23:59.000000000 +0900
+++ gnuplot-4.0.0_povrml/src/plot2d.c	2005-03-29 09:32:15.000000000 +0900
@@ -68,6 +68,8 @@
 static void eval_plots __PROTO((void));
 static void parametric_fixup __PROTO((struct curve_points * start_plot, int *plot_num));
 
+static void print_vrml __PROTO((void));
+static void print_povray __PROTO((void));
 
 /* internal and external variables */
 
@@ -842,6 +844,19 @@
     USES_AXIS_FOR_FUNC = 2
 } t_uses_axis;
 
+static void
+print_vrml()
+{
+  fprintf(stderr,"** vrml terminal does not support 'plot' command yet.\n");
+}
+
+static void
+print_povray()
+{
+  fprintf(stderr,"** povray terminal does not support 'plot' command yet.\n");
+}
+
+
 /*
  * This parses the plot command after any range specifications. To support
  * autoscaling on the x axis, we want any data files to define the x range,
@@ -1609,6 +1624,12 @@
 
     if (strcmp(term->name, "table") == 0)
 	print_table(first_plot, plot_num);
+    else 
+    if (strcmp(term->name, "vrml") == 0)
+    print_vrml();
+    else 
+    if (strcmp(term->name, "povray") == 0)
+    print_povray();
     else {
 	START_LEAK_CHECK();	/* check for memory leaks in this routine */
 
diff -Naur gnuplot-4.0.0/src/plot3d.c gnuplot-4.0.0_povrml/src/plot3d.c
--- gnuplot-4.0.0/src/plot3d.c	2004-04-14 02:23:59.000000000 +0900
+++ gnuplot-4.0.0_povrml/src/plot3d.c	2005-03-16 16:03:29.000000000 +0900
@@ -83,6 +83,16 @@
 					       TBOOLEAN need_palette));
 static void get_3ddata __PROTO((struct surface_points * this_plot));
 static void print_3dtable __PROTO((int pcount));
+
+static void print_povray __PROTO((int pcount));
+static void povray_make_grid __PROTO((double ticx,double ticy,double ticz,int axis));
+static void povray_make_label __PROTO((int lavelx,int lavely,int lavelz));
+static void povray_make_angle __PROTO(());
+
+static void print_vrml __PROTO((int pcount));
+static void vrml_make_grid __PROTO((double ticx,double ticy,double ticz,int axis));
+static void vrml_make_label __PROTO((int lavelx,int lavely,int lavelz));
+
 static void eval_3dplots __PROTO((void));
 static void grid_nongrid_data __PROTO((struct surface_points * this_plot));
 static void parametric_3dfixup __PROTO((struct surface_points * start_plot, int *plot_num));
@@ -970,6 +980,9 @@
 }
 #undef OUTPUT_NUMBER
 
+#include "povray.c"
+#include "vrml.c"
+
 /* HBB 20000501: code isolated from eval_3dplots(), where practically
  * identical code occured twice, for direct and crossing isolines,
  * respectively.  The latter only are done for in non-hidden3d
@@ -1756,6 +1769,12 @@
     /* perform the plot */
     if (strcmp(term->name, "table") == 0)
 	print_3dtable(plot_num);
+    else
+      if (strcmp(term->name, "povray") == 0)
+	print_povray(plot_num);
+    else
+      if (strcmp(term->name, "vrml") == 0)
+	print_vrml(plot_num);
     else {
 	START_LEAK_CHECK();	/* assert no memory leaks here ! */
 	do_3dplot(first_3dplot, plot_num, 0);
diff -Naur gnuplot-4.0.0/src/povray.c gnuplot-4.0.0_povrml/src/povray.c
--- gnuplot-4.0.0/src/povray.c	1970-01-01 09:00:00.000000000 +0900
+++ gnuplot-4.0.0_povrml/src/povray.c	2005-03-31 11:46:56.000000000 +0900
@@ -0,0 +1,538 @@
+/*
+ * povray.c v0.3 2005/03/30
+ */
+
+/* GNUPLOT - povray.c */
+
+/*
+ * included from plot3d.c
+ *
+ * ploting routines for povray terminal (POV-Ray scenes).
+ *
+ * AUTHORS
+ *  KITA Toshihiro  (http://t-kita.net/)
+ *  MIYATA Shigeo
+ *
+ * Copyright: public domain
+ * 
+ * send your comments or suggestions to (gnuplot-beta@lists.sourceforge.net).
+ * 
+ */
+
+static void
+print_povray(pcount)
+     int pcount;
+{
+  register struct surface_points *this_plot;
+  int i,j, surface,pointtype,style,linetype;
+  double ratiopoint,posx,posy,posz,skyx,skyy,skyz,light;
+  struct ratio{double x; double y; double z;}ratio;
+  struct tic{double x; double y; double z;}tic;
+  struct coordinate GPHUGE *point;
+  char *buffer = gp_alloc(150, "print_povray output buffer");
+  const char color[8][8]={"Red","Green","Blue","Magenta","SkyBlue","Brown","Yellow","Orange"};
+/*  const char glass[8][90]={"M_Ruby_Glass","M_Green_Glass","M_Vicks_Bottle_Glass","M_Glass","M_Dark_Green_Glass","M_NB_Beerbottle_Glass","M_Yellow_Glass","M_Orange_Glass"}; */
+
+  /*set view points*/
+
+  posx = sin(surface_rot_z/180*3.1415926535897)*sin(surface_rot_x/180*3.1415926535897)*500 + 25;
+  posy = -cos(surface_rot_z/180*3.1415926535897)*sin(surface_rot_x/180*3.1415926535897)*500 + 25;
+  posz = -cos(surface_rot_x/180*3.1415926535897)*500 - 20;
+
+  ratio.x=50/(axis_array[FIRST_X_AXIS].max - axis_array[FIRST_X_AXIS].min);
+  ratio.y=50/(axis_array[FIRST_Y_AXIS].max - axis_array[FIRST_Y_AXIS].min);
+  ratio.z=30/(axis_array[FIRST_Z_AXIS].max - axis_array[FIRST_Z_AXIS].min);
+
+  /*set tic data*/
+
+  tic.x=50*axis_array[FIRST_X_AXIS].ticdef.def.series.incr/(axis_array[FIRST_X_AXIS].max - axis_array[FIRST_X_AXIS].min);
+  if(tic.x==0)tic.x=12.5;
+  tic.y=50*axis_array[FIRST_Y_AXIS].ticdef.def.series.incr/(axis_array[FIRST_X_AXIS].max - axis_array[FIRST_X_AXIS].min);
+  if(tic.y==0)tic.y=12.5;
+  tic.z=50*axis_array[FIRST_Z_AXIS].ticdef.def.series.incr/(axis_array[FIRST_X_AXIS].max - axis_array[FIRST_X_AXIS].min);
+  if(tic.z==0)tic.z=10;
+
+  /*set sky parameter*/
+
+  if(surface_rot_x==0){
+    skyx=cos((surface_rot_z + 90)/180*3.1415926535897);
+    skyy=sin((surface_rot_z + 90)/180*3.1415926535897);
+    skyz=0;
+  }else if(surface_rot_x==180){
+    skyx=-cos((surface_rot_z + 90)/180*3.1415926535897);
+    skyy=-sin((surface_rot_z + 90)/180*3.1415926535897);
+    skyz=0;
+  }else{
+    skyx=0;
+    skyy=0;
+    skyz=-1;
+  }
+
+  /*set light_source value*/
+
+  if(0<=surface_rot_x&&surface_rot_x<=16){
+    light = 0.5 + (surface_rot_x/40);
+  }else if(164<=surface_rot_x&&surface_rot_x<=180){
+    light = 0.5 + ((180-surface_rot_x)/40);
+  }else{
+    light = 0.9;
+  }
+
+  fprintf(gpoutfile,"//creater: gnuplot povray terminal\n");	
+  fprintf(gpoutfile,"#version 3.5;\n");	
+  fprintf(gpoutfile,"#include \"colors.inc\" \n");
+  fprintf(gpoutfile,"#include \"shapes.inc\" \n");
+  fprintf(gpoutfile,"#include \"textures.inc\" \n");
+  /* fprintf(gpoutfile,"#include \"glass.inc\"\n"); */
+  fprintf(gpoutfile,"camera{ location <%g,%g,%g>\n",posx,posy,posz);
+  fprintf(gpoutfile,"sky <%g,%g,%g>\n",skyx,skyy,skyz);
+  fprintf(gpoutfile,"look_at <23,25,-18>\n");
+  /* fprintf(gpoutfile,"angle %g}\n",povray_make_angle()); */ /* subtle adjustment of 'angle' */
+  fprintf(gpoutfile,"angle %g}\n",13.0);
+  fprintf(gpoutfile,"background{ color White }\n");
+  fprintf(gpoutfile,"object{ Plane_XY texture{ PinkAlabaster }");
+  if(surface_rot_x>90) fprintf(gpoutfile," translate <0,0,-50>");
+  fprintf(gpoutfile,"}\nlight_source{ <%g, %g, %g> color %g* White }\n",posx,posy,posz,light);
+  fprintf(gpoutfile,"light_source{ <%g,%g,%g> color %g* White }\n",posx*0.4,posy*0.4,posz*0.7,light);
+  fprintf(gpoutfile,"//color_definition\n");
+  fprintf(gpoutfile,"//#declare Pcolor0 = material{texture{pigment{color Red filter 0.6} finish{ambient 0.05 phong 0.8}}}\n"); /* an example */
+  for(i=0; i<8; i++){
+    fprintf(gpoutfile,"#declare Pcolor%d = material{texture{pigment{color %s}}}\n",i+1,color[i]);
+  }
+/*
+  for(i=0; i<8; i++)
+    fprintf(gpoutfile,"//#declare Pcolor%d = material{%s}\n",i+9,glass[i]);
+*/
+  fprintf(gpoutfile,"#declare Grid = union{\n");
+
+  /* make grid */
+
+  if(270<surface_rot_z&&surface_rot_z<=360)
+    povray_make_grid(tic.x,tic.y,tic.z,1);
+  if(0<=surface_rot_z&&surface_rot_z<90)
+    povray_make_grid(tic.x,tic.y,tic.z,1);
+  if(90<=surface_rot_z&&surface_rot_z<=270)
+    povray_make_grid(tic.x,tic.y,tic.z,2);
+  if(0<=surface_rot_z&&surface_rot_z<180)
+    povray_make_grid(tic.x,tic.y,tic.z,3);
+  if(180<=surface_rot_z)
+    povray_make_grid(tic.x,tic.y,tic.z,4);
+  if(surface_rot_x<=90)
+    povray_make_grid(tic.x,tic.y,tic.z,5);
+  if(surface_rot_x>90)
+    povray_make_grid(tic.x,tic.y,tic.z,6);
+
+  fprintf(gpoutfile,"}\nobject{ Grid texture{DMFWood6}}\n");
+
+  /* make label */
+  if(270<=surface_rot_z&&surface_rot_z<=360){
+    if(0<=surface_rot_x&&surface_rot_x<=90)
+      povray_make_label(1,1,3);
+    if(90<surface_rot_x&&surface_rot_x<=180)
+      povray_make_label(3,3,3);
+  }
+
+  if(0<=surface_rot_z&&surface_rot_z<90){
+    if(0<=surface_rot_x&&surface_rot_x<=90)
+      povray_make_label(1,2,1);
+    if(90<surface_rot_x&&surface_rot_x<=180)
+      povray_make_label(3,4,1);
+  }
+
+  if(90<=surface_rot_z&&surface_rot_z<180){
+    if(0<=surface_rot_x&&surface_rot_x<=90)
+      povray_make_label(2,2,2);
+    if(90<surface_rot_x&&surface_rot_x<=180)
+      povray_make_label(4,4,2);
+  }
+
+  if(180<=surface_rot_z&&surface_rot_z<270){
+    if(0<=surface_rot_x&&surface_rot_x<=90)
+      povray_make_label(2,1,4);
+    if(90<surface_rot_x&&surface_rot_x<=180)
+      povray_make_label(4,3,4);
+  }
+
+  for (surface = 0, this_plot = first_3dplot;
+       surface < pcount;
+       this_plot = this_plot->next_sp, surface++) {
+
+    /*	fprintf(gpoutfile,"\n#Surface %d of %d surfaces\n", surface, pcount);*/
+
+    if (draw_surface) {
+      struct iso_curve *icrvs;
+      int curve;
+
+      fprintf(gpoutfile,"#declare Plot%d = union{\n",surface+1);
+
+      /* only the curves in one direction */
+      for (curve = 0, icrvs = this_plot->iso_crvs;
+	   icrvs && curve < this_plot->num_iso_read;
+	   icrvs = icrvs->next, curve++) {
+
+      double plot[this_plot->num_iso_read][icrvs->p_count][3];
+
+      /*	fprintf(gpoutfile, "\n#IsoCurve %d, %d points\n#x y z type\n",
+		curve, icrvs->p_count);*/
+
+	switch(this_plot->plot_style){
+	case LINES:
+	  style = 1;
+	  break;
+	case LINESPOINTS:
+	  style = 2;
+	  break;
+	case POINTSTYLE:
+	  style = 3;
+	  break;
+	default:
+	  style = 4;
+	  break;
+	}
+
+	pointtype = this_plot->lp_properties.p_type;
+	linetype = this_plot->lp_properties.l_type;
+
+	for (i = 0, point = icrvs->points;
+	     i < icrvs->p_count;
+	     i++, point++) {
+
+#define OUTPUT_NUMBER(field, axis)		       	\
+		    gprintf(buffer, 150,axis_array[axis].formatstring, \
+		    1.0, point->field);	    			       \
+                    ratiopoint = (point->field - axis_array[axis].min) * ratio.field;      \
+      		    fprintf(gpoutfile,"%g",ratiopoint);
+
+#define OUTPUT_NUMBERZ(field, axis)		       	\
+		    gprintf(buffer, 150,axis_array[axis].formatstring, \
+		    1.0, point->field);	    			       \
+                    ratiopoint = (point->field - axis_array[axis].min) * ratio.field+10;      \
+      		    fprintf(gpoutfile,"%g",ratiopoint);
+
+#define POV_OUTPUT()		       	\
+		    OUTPUT_NUMBER(x, FIRST_X_AXIS);	       	\
+		    fputc(',', gpoutfile);		       	\
+		    OUTPUT_NUMBER(y, FIRST_Y_AXIS);	      	\
+		    fputc(',', gpoutfile);		       	\
+		    fputc('-', gpoutfile);		       	\
+		    OUTPUT_NUMBERZ(z, FIRST_Z_AXIS); 
+
+
+#define SET_ARRAY(field, axis,m)		       	\
+		    gprintf(buffer, 150,axis_array[axis].formatstring, \
+		    1.0, point->field);	    			       \
+                    ratiopoint = (point->field - axis_array[axis].min) * ratio.field;      \
+      		    plot[curve][i][m] = ratiopoint;
+
+#define SET_ARRAYZ(field, axis,m)		       	\
+		    gprintf(buffer, 150,axis_array[axis].formatstring, \
+		    1.0, point->field);	    			       \
+                    ratiopoint = (point->field - axis_array[axis].min) * ratio.field + 10;      \
+      		    plot[curve][i][m] = ratiopoint;
+
+
+	  if(style == 4){
+	    SET_ARRAY(x, FIRST_X_AXIS,1);
+	    SET_ARRAY(y, FIRST_Y_AXIS,2);
+	    SET_ARRAYZ(z, FIRST_Z_AXIS,3); 
+
+	  }
+
+	  /*splot with points*/
+	  if( style == 3){
+	    fprintf(gpoutfile,"sphere{ < ");
+	    POV_OUTPUT();
+	    fprintf(gpoutfile,"> %g}\n",this_plot->lp_properties.p_size/2.0);
+	  }
+	  
+	  /*splot with linespoints*/
+	  if( style ==2){
+	    
+	    if(i == 0){
+	      fprintf(gpoutfile,"sphere{ < ");
+	      POV_OUTPUT();
+	      fprintf(gpoutfile,"> %g}\n",this_plot->lp_properties.p_size/2.0);
+	      fprintf(gpoutfile,"cylinder{<");	      
+	      POV_OUTPUT();
+	      fprintf(gpoutfile,">,<");
+	    }
+
+	    if(0 < i && i < icrvs->p_count - 1 ){
+	      POV_OUTPUT();
+	      fprintf(gpoutfile,">,%g}\n",this_plot->lp_properties.l_width/5.0);
+	      fprintf(gpoutfile,"sphere{ < ");
+	      POV_OUTPUT();
+	      fprintf(gpoutfile,"> %g}\n",this_plot->lp_properties.p_size/2.0);
+	      fprintf(gpoutfile,"cylinder{<");
+	      POV_OUTPUT();
+	      fprintf(gpoutfile,">,<");
+	    }
+	    
+	    if(i == icrvs->p_count - 1 ){
+	      POV_OUTPUT();
+ 	      fprintf(gpoutfile,">,%g}\n",this_plot->lp_properties.l_width/5.0);
+	      fprintf(gpoutfile,"sphere{ < ");
+	      POV_OUTPUT();
+	      fprintf(gpoutfile,"> %g}\n",this_plot->lp_properties.p_size/2.0);
+	    }
+	  }
+
+	  /*splot with lines*/
+	  if(style == 1){
+	    
+	    if(i == 0){
+	      fprintf(gpoutfile,"cylinder{<");
+	      POV_OUTPUT();	      
+	      fprintf(gpoutfile,">,<");
+	    }
+
+	    if(0 < i && i < icrvs->p_count - 1 ){
+	      POV_OUTPUT();
+	      fprintf(gpoutfile,">,%g}\ncylinder{<",this_plot->lp_properties.l_width/5.0);
+	      POV_OUTPUT();
+	      fprintf(gpoutfile,">,<");
+	    }
+	    
+	    if(i == icrvs->p_count - 1 ){
+	      POV_OUTPUT();
+ 	      fprintf(gpoutfile,">,%g}\n",this_plot->lp_properties.l_width/5.0);
+	    }
+	  }
+
+	} /* for(point) */
+
+
+	if(style==4){
+	  int p;
+
+	  if(curve > 0){
+	    for(p=1; p<icrvs->p_count; p++){
+
+	      fprintf(gpoutfile,"triangle{<%g,%g,-%g>,<%g,%g,-%g>,<%g,%g,-%g>}\n",plot[curve][p-1][1],plot[curve][p-1][2],plot[curve][p-1][3],plot[curve-1][p][1],plot[curve-1][p][2],plot[curve-1][p][3],plot[curve-1][p-1][1],plot[curve-1][p-1][2],plot[curve-1][p-1][3]);
+
+		fprintf(gpoutfile,"triangle{<%g,%g,-%g>,<%g,%g,-%g>,<%g,%g,-%g>}\n",plot[curve][p][1],plot[curve][p][2],plot[curve][p][3],plot[curve][p-1][1],plot[curve][p-1][2],plot[curve][p-1][3],plot[curve-1][p][1],plot[curve-1][p][2],plot[curve-1][p][3]);
+
+	    }
+	  }
+	}
+
+      } /* for(icrvs) */
+
+      if(style == 3){
+	fprintf(gpoutfile,"}\nobject{Plot%d material{Pcolor%d}}\n",surface+1,pointtype+1);
+      }else{
+	fprintf(gpoutfile,"}\nobject{Plot%d material{Pcolor%d}}\n",surface+1,linetype+1);
+      }
+      putc('\n', gpoutfile);
+
+    } /* if(draw_surface) */
+  
+  } /* for(surface) */
+
+    fflush(gpoutfile);
+    
+    free(buffer);
+} 
+#undef OUTPUT_NUMBER
+#undef OUTPUT_NUMBERZ
+#undef POV_OUTPUT
+#undef OUTPUT_ARRAY
+#undef OUTPUT_ARRAYZ
+
+
+
+
+static void
+povray_make_label(int labelx,int labely,int labelz){
+  
+  int xposy,xposz,yposx,yposz,zposx,zposy;
+  const double sthick= 0.2;
+
+  /*make xrange label*/
+
+  if(labelx==1){xposy = -7;xposz = -1;}
+  if(labelx==2){xposy = 57;xposz = -1;}
+  if(labelx==3){xposy = -7;xposz = -37;}
+  if(labelx==4){xposy = 57;xposz = -37;}
+  
+  fprintf(gpoutfile,"text{ ttf \"crystal.ttf\",\"%g\",%g,0\n",axis_array[FIRST_X_AXIS].min,sthick);
+  fprintf(gpoutfile,"pigment{White}\nscale 4\n");
+  fprintf(gpoutfile,"rotate<-%g,0,%g>\n",surface_rot_x,surface_rot_z);
+  fprintf(gpoutfile,"translate<3,%d,%d>\n",xposy,xposz);
+  fprintf(gpoutfile,"finish{ambient 3}\n}\n");
+
+  if(strlen(axis_array[FIRST_X_AXIS].label.text) != 0){
+  fprintf(gpoutfile,"text{ ttf \"crystal.ttf\",\"%s\",%g,0\n",axis_array[FIRST_X_AXIS].label.text,sthick);
+  fprintf(gpoutfile,"pigment{White}\nscale 4\n");
+ fprintf(gpoutfile,"rotate<-%g,0,%g>\n",surface_rot_x,surface_rot_z);
+ fprintf(gpoutfile,"translate<20,%d,%d>\n",xposy,xposz);
+ fprintf(gpoutfile," finish{ambient 1}\n}\n");
+  }
+
+ fprintf(gpoutfile,"text{ ttf \"crystal.ttf\",\"%g\",%g,0\n",axis_array[FIRST_X_AXIS].max,sthick);
+ fprintf(gpoutfile,"pigment{White}\n");
+ fprintf(gpoutfile,"scale 4\nrotate<-%g,0,%g>\n",surface_rot_x,surface_rot_z);
+ fprintf(gpoutfile,"translate<47,%d,%d>\n",xposy,xposz);
+ fprintf(gpoutfile,"finish{ambient 3}\n}\n");
+
+ /*make yrange label*/
+ 
+ if(labely==1){yposx = -7;yposz = -1;}
+ if(labely==2){yposx = 57;yposz = -1;}
+ if(labely==3){yposx = -7;yposz = -37;}
+ if(labely==4){yposx = 57;yposz = -37;}
+ 
+ fprintf(gpoutfile,"text{ ttf \"crystal.ttf\",\"%g\",%g,0\n",axis_array[FIRST_Y_AXIS].min,sthick);
+ fprintf(gpoutfile,"pigment{White}\n");
+ fprintf(gpoutfile,"scale 4\nrotate<-%g,0,%g>\n",surface_rot_x,surface_rot_z);
+ fprintf(gpoutfile,"translate<%d,3,%d>\n",yposx,yposz);
+ fprintf(gpoutfile,"finish{ambient 3}\n}\n");
+ 
+  if(strlen(axis_array[FIRST_Y_AXIS].label.text) != 0){
+ fprintf(gpoutfile,"text{ ttf \"crystal.ttf\",\"%s\",%g,0\n",axis_array[FIRST_Y_AXIS].label.text,sthick);
+ fprintf(gpoutfile,"pigment{White}\n");
+ fprintf(gpoutfile,"scale 4\nrotate<-%g,0,%g>\n",surface_rot_x,surface_rot_z);
+ fprintf(gpoutfile,"translate<%d,20,%d>\n",yposx,yposz);
+ fprintf(gpoutfile," finish{ambient 1}\n}\n");
+  }
+
+ fprintf(gpoutfile,"text{ ttf \"crystal.ttf\",\"%g\",%g,0\n",axis_array[FIRST_Y_AXIS].max,sthick);
+ fprintf(gpoutfile,"pigment{White}\n");
+ fprintf(gpoutfile,"scale 4\nrotate<-%g,0,%g>\n",surface_rot_x,surface_rot_z);
+ fprintf(gpoutfile,"translate<%d,47,%d>\n",yposx,yposz);
+ fprintf(gpoutfile,"finish{ambient 3}\n}\n");
+
+ /*make zrange label*/
+
+ if(labelz==1){zposx = -5;zposy = -5;}
+ if(labelz==2){zposx = 55;zposy = -5;}
+ if(labelz==3){zposx = -5;zposy = 55;}
+ if(labelz==4){zposx = 55;zposy = 55;}
+ 
+ fprintf(gpoutfile,"text{ ttf \"crystal.ttf\",\"%g\",%g,0\n",axis_array[FIRST_Z_AXIS].min,sthick);
+ fprintf(gpoutfile,"pigment{White}\n");
+ fprintf(gpoutfile,"scale 4\nrotate<-%g,0,%g>\n",surface_rot_x,surface_rot_z);
+ fprintf(gpoutfile,"translate<%d,%d,-10>\n",zposx,zposy);
+ fprintf(gpoutfile,"finish{ambient 3}\n}\n");
+ 
+  if(strlen(axis_array[FIRST_X_AXIS].label.text) != 0){
+ fprintf(gpoutfile,"text{ ttf \"crystal.ttf\",\"%s\",%g,0\n",axis_array[FIRST_Z_AXIS].label.text,sthick);
+ fprintf(gpoutfile,"pigment{White}\n");
+ fprintf(gpoutfile,"scale 4\nrotate<-%g,0,%g>\n",surface_rot_x,surface_rot_z);
+ fprintf(gpoutfile,"translate<%d,%d,-25>\n",zposx,zposy);
+ fprintf(gpoutfile," finish{ambient 1}\n}\n");
+  }
+ 
+ fprintf(gpoutfile,"text{ ttf \"crystal.ttf\",\"%g\",%g,0\n",axis_array[FIRST_Z_AXIS].max,sthick);
+ fprintf(gpoutfile,"pigment{White}\n");
+ fprintf(gpoutfile,"scale 4\n");
+ fprintf(gpoutfile,"rotate<-%g,0,%g>\n",surface_rot_x,surface_rot_z);
+ fprintf(gpoutfile,"translate<%d,%d,-37>\n",zposx,zposy);
+ fprintf(gpoutfile,"finish{ambient 3}\n}\n");
+}
+
+static void
+povray_make_grid(double ticx,double ticy,double ticz,int axis){
+  
+  int i;
+  double t,pos,posz;
+  
+  if(surface_rot_x > 90)posz = -10;
+  if(surface_rot_x <= 90)posz = 0;
+
+  if(axis==1||axis==2){
+    if(axis==1)
+      pos=50;
+    if(axis==2)
+      pos=0;
+    fprintf(gpoutfile,"sphere{<0,%g,%g>0.5}\n",pos,posz);
+    fprintf(gpoutfile,"sphere{<0,%g,%g>0.5}\n",pos,-40+posz);
+    fprintf(gpoutfile,"sphere{<50,%g,%g>0.5}\n",pos,posz);
+    fprintf(gpoutfile,"sphere{<50,%g,%g>0.5}\n",pos,-40+posz);
+    fprintf(gpoutfile,"cylinder{<0,%g,%g>,<0,%g,%g>,0.5}\n",pos,posz,pos,posz-40);
+    fprintf(gpoutfile,"cylinder{<0,%g,%g>,<50,%g,%g>,0.5}\n",pos,posz-40,pos,posz-40);
+    fprintf(gpoutfile,"cylinder{<50,%g,%g>,<50,%g,%g>,0.5}\n",pos,posz-40,pos,posz);
+    fprintf(gpoutfile,"cylinder{<50,%g,%g>,<0,%g,%g>,0.5}\n",pos,posz,pos,posz);
+    for(i=1; ticx*i<50; i++){
+      fprintf(gpoutfile,"cylinder{<%g,%g,%g>,<%g,%g,%g>,0.2}\n",ticx*i,pos,posz,ticx*i,pos,posz-40);
+    }
+    for(i=0; ticz*i<30; i++){
+      fprintf(gpoutfile,"cylinder{<0,%g,-%g><50,%g,-%g>,0.2}\n",pos,ticz*i+10-posz,pos,ticz*i+10-posz);
+    }
+  }
+  
+  if(axis==3||axis==4){
+    if(axis==3)pos=0;
+    if(axis==4)pos=50;
+    fprintf(gpoutfile,"sphere{<%g,0,%g>0.5}\n",pos,posz);
+    fprintf(gpoutfile,"sphere{<%g,0,%g>0.5}\n",pos,-40+posz);
+    fprintf(gpoutfile,"sphere{<%g,50,%g>0.5}\n",pos,posz);
+    fprintf(gpoutfile,"sphere{<%g,50,%g>0.5}\n",pos,-40+posz);
+    fprintf(gpoutfile,"cylinder{<%g,0,%g>,<%g,0,%g>,0.5}\n",pos,posz,pos,posz-40);
+    fprintf(gpoutfile,"cylinder{<%g,0,%g>,<%g,50,%g>,0.5}\n",pos,posz-40,pos,posz-40);
+    fprintf(gpoutfile,"cylinder{<%g,50,%g>,<%g,50,%g>,0.5}\n",pos,posz-40,pos,posz);
+    fprintf(gpoutfile,"cylinder{<%g,50,%g>,<%g,0,%g>,0.5}\n",pos,posz,pos,posz);
+    for(i=1; ticy*i<50; i++){
+      fprintf(gpoutfile,"cylinder{<%g,%g,%g>,<%g,%g,%g>,0.2}\n",pos,ticy*i,posz,pos,ticy*i,posz-40);
+    }
+    for(i=0; ticz*i<30; i++){
+      fprintf(gpoutfile,"cylinder{<%g,0,-%g>,<%g,50,-%g>,0.2}\n",pos,ticz*i+10-posz,pos,ticz*i+10-posz);
+    }
+  }
+  
+  if(axis==5||axis==6){
+    if(axis==5)
+      pos=0;
+    if(axis==6)
+	pos=-40;
+    fprintf(gpoutfile,"sphere{<0,0,%g>0.5}\n",pos+posz);
+    fprintf(gpoutfile,"sphere{<0,50,%g>0.5}\n",pos+posz);
+    fprintf(gpoutfile,"sphere{<50,0,%g>0.5}\n",pos+posz);
+    fprintf(gpoutfile,"sphere{<50,50,%g>0.5}\n",pos+posz);
+    fprintf(gpoutfile,"cylinder{<0,0,%g>,<0,50,%g>,0.5}\n",pos+posz,pos+posz);
+    fprintf(gpoutfile,"cylinder{<0,50,%g>,<50,50,%g>,0.5}\n",pos+posz,pos+posz);
+    fprintf(gpoutfile,"cylinder{<50,50,%g>,<50,0,%g>,0.5}\n",pos+posz,pos+posz);
+    fprintf(gpoutfile,"cylinder{<50,0,%g>,<0,0,%g>,0.5}\n",pos+posz,pos+posz);
+    for(i=1; ticx*i<50; i++){
+      fprintf(gpoutfile,"cylinder{<%g,0,%g>,<%g,50,%g>,0.2}\n",ticx*i,pos+posz,ticx*i,pos+posz);
+    }
+      for(i=1; ticy*i<50; i++){
+	fprintf(gpoutfile,"cylinder{<0,%g,%g><50,%g,%g>,0.2}\n",ticy*i,pos+posz,ticy*i,pos+posz);
+      }
+  }
+}
+
+
+
+#if 0
+static double
+povray_make_angle(){
+  double angle,anglex,anglez;
+  
+  if(0<=surface_rot_z&&surface_rot_z<90)
+    anglez = (surface_rot_z - 45)/45;
+  if(90<=surface_rot_z&&surface_rot_z<180)
+    anglez =(surface_rot_z - 135)/45;
+  if(180<=surface_rot_z&&surface_rot_z<270)
+    anglez = (surface_rot_z - 225)/45;
+  if(270<=surface_rot_z&&surface_rot_z<=360)
+    anglez=(surface_rot_z - 315)/45;
+    
+  if(anglez < 0) anglez = anglez*(-1); 
+  anglez = 1 - anglez;
+
+  if(0<=surface_rot_x&&surface_rot_x<90)
+    anglex=(surface_rot_x - 45)/45;
+  if(90<=surface_rot_x&&surface_rot_x<=180)
+    anglex=(surface_rot_x - 135)/45;
+
+  if(anglex<0) anglex = anglex*(-1); 
+  anglex = 1 - anglex;
+  angle = (anglex + anglez)*1.5;
+
+  return angle + 11.0;
+
+  /* For making an animated image, it is better to do nothing. */
+  /* return 13.0; */
+}
+#endif /* #if 0 */
diff -Naur gnuplot-4.0.0/src/term.h gnuplot-4.0.0_povrml/src/term.h
--- gnuplot-4.0.0/src/term.h	2004-04-14 02:24:02.000000000 +0900
+++ gnuplot-4.0.0_povrml/src/term.h	2005-03-21 18:36:51.000000000 +0900
@@ -442,4 +442,10 @@
 # include "ggi.trm"
 #endif
 
+/* POV-Ray scene */
+# include "povray.trm"
+
+/* VRML */
+# include "vrml.trm"
+
 #endif /* !SHORT_TERMLIST */
diff -Naur gnuplot-4.0.0/src/vrml.c gnuplot-4.0.0_povrml/src/vrml.c
--- gnuplot-4.0.0/src/vrml.c	1970-01-01 09:00:00.000000000 +0900
+++ gnuplot-4.0.0_povrml/src/vrml.c	2005-03-31 11:46:53.000000000 +0900
@@ -0,0 +1,399 @@
+/*
+ * vrml.c v0.25 2005/03/30
+ */
+
+/* GNUPLOT - vrml.c */
+
+/*
+ * included from plot3d.c
+ *
+ * ploting routines for vrml terminal (VRML scenes).
+ *
+ * AUTHORS
+ *  KITA Toshihiro  (http://t-kita.net/)
+ *  MIYATA Shigeo
+ *
+ * Copyright: public domain
+ * 
+ * send your comments or suggestions to (gnuplot-beta@lists.sourceforge.net).
+ * 
+ */
+
+static void
+print_vrml(pcount)
+    int pcount;
+
+{
+  register struct surface_points *this_plot;
+  int i,j, surface,pointtype,linetype,style,margin;
+  double ratiopoint,posx,posy,posz,pang;
+  double p[2][3],ploc[3],pvec[3],longth;
+  struct ratio{double x; double y; double z;}ratio;
+  struct tic{double x; double y; double z;}tic;
+  struct coordinate GPHUGE *point;
+  char *buffer = gp_alloc(150, "print_vrml output buffer");
+  static double color[8][3]={{1,0,0},{0,1,0},{0,0,1},{1,0,1},{0,1,1},{0.545,0.27,0.075},{1,1,0},{1,0.647,0}};
+  
+  posx = sin(surface_rot_z/180*3.1415926535897)*100+25;
+  posy = -cos(surface_rot_z/180*3.1415926535897)*100+25;
+  posz = cos(surface_rot_x/180*3.1415926535897)*100+20;
+
+    ratio.x=50/(axis_array[FIRST_X_AXIS].max - axis_array[FIRST_X_AXIS].min);
+    ratio.y=50/(axis_array[FIRST_Y_AXIS].max - axis_array[FIRST_Y_AXIS].min);
+    ratio.z=30/(axis_array[FIRST_Z_AXIS].max - axis_array[FIRST_Z_AXIS].min);
+
+    tic.x=50*axis_array[FIRST_X_AXIS].ticdef.def.series.incr/(axis_array[FIRST_X_AXIS].max - axis_array[FIRST_X_AXIS].min);
+    if(tic.x==0)tic.x=12.5;
+    tic.y=50*axis_array[FIRST_Y_AXIS].ticdef.def.series.incr/(axis_array[FIRST_X_AXIS].max - axis_array[FIRST_X_AXIS].min);
+    if(tic.y==0)tic.y=12.5;
+    tic.z=50*axis_array[FIRST_Z_AXIS].ticdef.def.series.incr/(axis_array[FIRST_X_AXIS].max - axis_array[FIRST_X_AXIS].min);
+    if(tic.z==0)tic.z=10;
+      fprintf(gpoutfile,"#VRML V2.0 utf8\n");
+      fprintf(gpoutfile,"Background{ skyColor 0 0 0 }\n");
+      fprintf(gpoutfile,"Viewpoint { position  75 -46 60\norientation 1 0.5 0.5 1.17}\n");
+
+      fprintf(gpoutfile,"\n");
+
+      if(surface_rot_x<=90)margin=10;
+      if(surface_rot_x>90)margin=0;
+
+      /* make grid */
+      
+  if(270<surface_rot_z&&surface_rot_z<=360)
+    vrml_make_grid(tic.x,tic.y,tic.z,1);
+  if(0<=surface_rot_z&&surface_rot_z<90)
+    vrml_make_grid(tic.x,tic.y,tic.z,1);
+  if(90<=surface_rot_z&&surface_rot_z<=270)
+    vrml_make_grid(tic.x,tic.y,tic.z,2);
+  if(0<=surface_rot_z&&surface_rot_z<180)
+    vrml_make_grid(tic.x,tic.y,tic.z,3);
+  if(180<=surface_rot_z)
+    vrml_make_grid(tic.x,tic.y,tic.z,4);
+  if(surface_rot_x<=90)
+    vrml_make_grid(tic.x,tic.y,tic.z,5);
+  if(surface_rot_x>90)
+    vrml_make_grid(tic.x,tic.y,tic.z,6);
+
+      /* make label */
+
+  if(270<=surface_rot_z&&surface_rot_z<=360){
+    if(0<=surface_rot_x&&surface_rot_x<=90)
+      vrml_make_label(1,1,3);
+    if(90<surface_rot_x&&surface_rot_x<=180)
+      vrml_make_label(3,3,3);
+  }
+
+  if(0<=surface_rot_z&&surface_rot_z<90){
+    if(0<=surface_rot_x&&surface_rot_x<=90)
+      vrml_make_label(1,2,1);
+    if(90<surface_rot_x&&surface_rot_x<=180)
+      vrml_make_label(3,4,1);
+  }
+
+  if(90<=surface_rot_z&&surface_rot_z<180){
+    if(0<=surface_rot_x&&surface_rot_x<=90)
+      vrml_make_label(2,2,2);
+    if(90<surface_rot_x&&surface_rot_x<=180)
+      vrml_make_label(4,4,2);
+  }
+
+  if(180<=surface_rot_z&&surface_rot_z<270){
+    if(0<=surface_rot_x&&surface_rot_x<=90)
+      vrml_make_label(2,1,4);
+    if(90<surface_rot_x&&surface_rot_x<=180)
+      vrml_make_label(4,3,4);
+  }
+
+  for (surface = 0, this_plot = first_3dplot;
+       surface < pcount;
+       this_plot = this_plot->next_sp, surface++) {
+
+    if (draw_surface) {
+      struct iso_curve *icrvs;
+      int curve;
+	
+      /* only the curves in one direction */
+      for (curve = 0, icrvs = this_plot->iso_crvs;
+	   icrvs && curve < this_plot->num_iso_read;
+	   icrvs = icrvs->next, curve++) {
+
+	switch(this_plot->plot_style){
+	case LINES:
+	  style = 1;
+	  break;
+	case LINESPOINTS:
+	  style = 2;
+	  break;
+	case POINTSTYLE:
+	  style = 3;
+	  break;
+	default:
+	  style = 4;
+	  break;
+	}
+
+	pointtype = this_plot->lp_properties.p_type%8;    
+	linetype = this_plot->lp_properties.l_type%8;
+	
+	for (i = 0, point = icrvs->points;
+	     i < icrvs->p_count;
+	     i++, point++) {
+
+	  if(style >= 2){
+
+#define OUTPUT_NUMBER(field, axis)		       	\
+		    gprintf(buffer, 150,axis_array[axis].formatstring, \
+		    1.0, point->field);	    			       \
+                    ratiopoint = (point->field - axis_array[axis].min) * ratio.field;      \
+      		    fprintf(gpoutfile,"%g",ratiopoint);
+	  
+#define OUTPUT_NUMBERZ(field, axis)		       	\
+		    gprintf(buffer, 150,axis_array[axis].formatstring, \
+		    1.0, point->field);	    			       \
+                    ratiopoint = (point->field - axis_array[axis].min) * ratio.field+margin;      \
+      		    fprintf(gpoutfile,"%g",ratiopoint);
+
+#define SET_LINE(field, axis,m)		       	\
+		    gprintf(buffer, 150,axis_array[axis].formatstring, \
+		    1.0, point->field);	    			       \
+                    ratiopoint = (point->field - axis_array[axis].min) * ratio.field;      \
+      		    p[0][m] = ratiopoint;
+
+	    fprintf(gpoutfile,"Transform {translation ");
+	    OUTPUT_NUMBER(x, FIRST_X_AXIS);
+	    fputc(' ', gpoutfile);
+	    OUTPUT_NUMBER(y, FIRST_Y_AXIS);
+	    fputc(' ', gpoutfile);
+	    OUTPUT_NUMBERZ(z, FIRST_Z_AXIS);
+
+	    fprintf(gpoutfile,"children[Shape { appearance Appearance { material Material { diffuseColor %g %g %g} } geometry Sphere { radius %g }}]}\n",color[pointtype][0],color[pointtype][1],color[pointtype][2],this_plot->lp_properties.p_size*0.5);
+	  }
+
+	  if(style <= 2){
+
+	      SET_LINE(x, FIRST_X_AXIS,0);
+	      SET_LINE(y, FIRST_Y_AXIS,1);
+	      SET_LINE(z, FIRST_Z_AXIS,2); 
+
+	    if(i > 0){
+
+	      ploc[0]=(p[0][0] + p[1][0])/2;
+	      ploc[1]=(p[0][1] + p[1][1])/2;
+	      ploc[2]=(p[0][2] + p[1][2])/2;
+	      pvec[0]=p[0][0] - p[1][0];
+	      pvec[1]=p[0][1] - p[1][1];
+	      pvec[2]=p[0][2] - p[1][2];
+
+	      longth = sqrt((p[0][0]-p[1][0])*(p[0][0]-p[1][0])+(p[0][1]-p[1][1])*(p[0][1]-p[1][1])+(p[0][2]-p[1][2])*(p[0][2]-p[1][2]));
+	      pang = acos(pvec[1]/sqrt(pvec[0]*pvec[0]+pvec[1]*pvec[1]+pvec[2]*pvec[2]));
+	      /*
+	    fprintf(gpoutfile,"<%g,%g,%g>,<%g,%g,%g>\n",p[0][0],p[0][1],p[0][2],p[1][0],p[1][1],p[1][2]);
+	      fprintf(gpoutfile,"arccos=%g\n",pang);
+	      fprintf(gpoutfile,"long1=%g\n",longth);
+	      */
+	      fprintf(gpoutfile,"Transform {translation %g %g %g rotation %g 0 %g %g children[Shape {appearance Appearance {material Material{ diffuseColor %g %g %g}}geometry Cylinder{radius %g height %g}}]}\n",ploc[0],ploc[1],ploc[2]+margin,pvec[2],-pvec[0],pang,color[linetype][0],color[linetype][1],color[linetype][2],this_plot->lp_properties.l_width/5,longth);
+
+	    }
+
+	    p[1][0] = p[0][0];
+	    p[1][1] = p[0][1];
+	    p[1][2] = p[0][2];
+
+	  }
+	} /* for(point) */
+      } /* for(icrvs) */
+    } /* if(draw_surface) */
+  } /* for(surface) */
+
+    fprintf(gpoutfile,"\n");
+    
+    fflush(gpoutfile);
+    
+    free(buffer);
+} 
+#undef OUTPUT_NUMBER
+#undef OUTPUT_NUMBERZ
+#undef SET_LINE
+#undef SET_LINEZ
+
+static void
+vrml_make_label(int labelx,int labely,int labelz){
+  
+  int xposy,xposz,yposx,yposz,zposx,zposy,margin;
+
+  if(surface_rot_x<=90)margin=10;
+  if(surface_rot_x>90)margin=0;
+
+  /*make xrange label*/
+  
+  if(labelx==1){xposy = -5;xposz = -1;}
+  if(labelx==2){xposy = 55;xposz = -1;}
+  if(labelx==3){xposy = -5;xposz = 41;}
+  if(labelx==4){xposy = 55;xposz = 41;}
+  
+  fprintf(gpoutfile,"Transform {translation 0 %d %d\n",xposy,xposz);
+  fprintf(gpoutfile,"children[Billboard{axisOfRotation 0 0 0children[Shape{appearance Appearance {material Material {diffuseColor 0 1 1}} geometry Text {\n");
+  fprintf(gpoutfile,"string \" %g \"\n",axis_array[FIRST_X_AXIS].min);
+  fprintf(gpoutfile,"fontStyle FontStyle {size 4}}}]}]}\n");
+
+  fprintf(gpoutfile,"Transform {translation 50 %d %d\n",xposy,xposz);
+  fprintf(gpoutfile,"children[Billboard{axisOfRotation 0 0 0children[Shape{appearance Appearance {material Material {diffuseColor 0 1 1}} geometry Text {\n");
+  fprintf(gpoutfile,"string \" %g \"\n",axis_array[FIRST_X_AXIS].max);
+  fprintf(gpoutfile,"fontStyle FontStyle {size 4}}}]}]}\n");
+
+  if(strlen(axis_array[FIRST_X_AXIS].label.text) != 0){
+  fprintf(gpoutfile,"Transform {translation 25 %d %d\n",xposy,xposz);
+  fprintf(gpoutfile,"children[Billboard{axisOfRotation 0 0 0children[Shape{appearance Appearance {material Material {diffuseColor 0 1 1}} geometry Text {\n");
+  fprintf(gpoutfile,"string \" %s \"\n",axis_array[FIRST_X_AXIS].label.text);
+  fprintf(gpoutfile,"fontStyle FontStyle {size 4}}}]}]}\n");
+  }
+ /*make yrange label*/
+ 
+ if(labely==1){yposx = -5;yposz = -1;}
+ if(labely==2){yposx = 55;yposz = -1;}
+ if(labely==3){yposx = -5;yposz = 41;}
+ if(labely==4){yposx = 55;yposz = 41;}
+
+  fprintf(gpoutfile,"Transform {translation %d 0 %d\n",yposx,yposz);
+  fprintf(gpoutfile,"children[Billboard{axisOfRotation 0 0 0children[Shape{appearance Appearance {material Material {diffuseColor 0.4 1.0 0.4}} geometry Text {\n");
+  fprintf(gpoutfile,"string \" %g \"\n",axis_array[FIRST_Y_AXIS].min);
+  fprintf(gpoutfile,"fontStyle FontStyle {size 4}}}]}]}\n");
+
+  fprintf(gpoutfile,"Transform {translation %d 50 %d\n",yposx,yposz);
+  fprintf(gpoutfile,"children[Billboard{axisOfRotation 0 0 0children[Shape{appearance Appearance {material Material {diffuseColor 0.4 1.0 0.4}} geometry Text {\n");
+  fprintf(gpoutfile,"string \" %g \"\n",axis_array[FIRST_Y_AXIS].max);
+  fprintf(gpoutfile,"fontStyle FontStyle {size 4}}}]}]}\n");
+
+  if(strlen(axis_array[FIRST_Y_AXIS].label.text) != 0){
+  fprintf(gpoutfile,"Transform {translation %d 25 %d\n",yposx,yposz);
+  fprintf(gpoutfile,"children[Billboard{axisOfRotation 0 0 0children[Shape{appearance Appearance {material Material {diffuseColor 0.4 1.0 0.4}} geometry Text {\n");
+  fprintf(gpoutfile,"string \" %s \"\n",axis_array[FIRST_Y_AXIS].label.text);
+  fprintf(gpoutfile,"fontStyle FontStyle {size 4}}}]}]}\n");
+  }
+
+ /*make zrange label*/
+
+ if(labelz==1){zposx = -5;zposy = -3;}
+ if(labelz==2){zposx = 55;zposy = -3;}
+ if(labelz==3){zposx = -5;zposy = 53;}
+ if(labelz==4){zposx = 55;zposy = 53;}
+
+  fprintf(gpoutfile,"Transform {translation %d %d %d\n",zposx,zposy,margin-2);
+  fprintf(gpoutfile,"children[Billboard{axisOfRotation 0 0 0children[Shape{appearance Appearance {material Material {diffuseColor 1 1 0}} geometry Text {\n");
+  fprintf(gpoutfile,"string \" %g \"\n",axis_array[FIRST_Z_AXIS].min);
+  fprintf(gpoutfile,"fontStyle FontStyle {size 4}}}]}]}\n");
+
+  fprintf(gpoutfile,"Transform {translation %d %d %d\n",zposx,zposy,margin+28);
+  fprintf(gpoutfile,"children[Billboard{axisOfRotation 0 0 0children[Shape{appearance Appearance {material Material {diffuseColor 1 1 0}} geometry Text {\n");
+  fprintf(gpoutfile,"string \" %g \"\n",axis_array[FIRST_Z_AXIS].max);
+  fprintf(gpoutfile,"fontStyle FontStyle {size 4}}}]}]}\n");
+
+  if(strlen(axis_array[FIRST_Z_AXIS].label.text) != 0){
+  fprintf(gpoutfile,"Transform {translation %d %d %d\n",zposx,zposy,margin+15);
+  fprintf(gpoutfile,"children[Billboard{axisOfRotation 0 0 0children[Shape{appearance Appearance {material Material {diffuseColor 1 1 0}} geometry Text {\n");
+  fprintf(gpoutfile,"string \" %s \"\n",axis_array[FIRST_Z_AXIS].label.text);
+  fprintf(gpoutfile,"fontStyle FontStyle {size 4}}}]}]}\n");
+  }
+
+}
+
+static void
+vrml_make_grid(double ticx,double ticy,double ticz,int axis){
+  
+  int i;
+  double t,pos,pi;
+
+  pi=3.1415926535897;
+
+  if(axis==1||axis==2){
+    if(axis==1)
+      pos=50;
+    if(axis==2)
+      pos=0;
+    fprintf(gpoutfile,"Transform {translation 0 %g 0 children[Shape { appearance Appearance { material Material{}} geometry Sphere { radius 0.3 }}]}\n",pos);
+    fprintf(gpoutfile,"Transform {translation 0 %g 40 children[Shape { appearance Appearance { material Material{}} geometry Sphere { radius 0.3 }}]}\n",pos);
+    fprintf(gpoutfile,"Transform {translation 50 %g 0 children[Shape { appearance Appearance { material Material{}} geometry Sphere { radius 0.3 }}]}\n",pos);
+    fprintf(gpoutfile,"Transform {translation 50 %g 40 children[Shape { appearance Appearance { material Material{}} geometry Sphere { radius 0.3 }}]}\n",pos);
+
+    fprintf(gpoutfile,"Transform {translation 25 %g 0\n",pos);
+    fprintf(gpoutfile,"rotation 0 0 1 %g\n",pi/2);
+    fprintf(gpoutfile,"children[DEF haxis Shape{appearance Appearance{ material Material {}} geometry Cylinder {radius 0.3 height 50}}]}\n");
+    fprintf(gpoutfile,"Transform {translation 25 %g 40\n",pos);
+    fprintf(gpoutfile,"rotation 0 0 1 %g\n",pi/2);
+    fprintf(gpoutfile,"children[USE haxis]}\n");
+
+    fprintf(gpoutfile,"Transform {translation 0 %g 20\n",pos);
+    fprintf(gpoutfile,"rotation 1 0 0 %g\n",pi/2);
+    fprintf(gpoutfile,"children[DEF vaxis Shape{appearance Appearance{ material Material {}} geometry Cylinder {radius 0.3 height 40}}]}\n");
+    fprintf(gpoutfile,"Transform {translation 50 %g 20\n",pos);
+    fprintf(gpoutfile,"rotation 1 0 0 %g\n",pi/2);
+    fprintf(gpoutfile,"children[USE vaxis]}\n");
+
+    for(i=1;ticx*i<50;i++){
+      fprintf(gpoutfile,"Transform {translation %g %g 20 rotation 1 0 0 %gchildren[Shape {appearance Appearance {material Material{}}geometry Cylinder{radius 0.1 height 40}}]}\n",ticx*i,pos,pi/2);
+    }
+    for(i=0;ticz*i<30;i++){
+      fprintf(gpoutfile,"Transform {translation 25 %g %g rotation 0 0 1 %gchildren[Shape {appearance Appearance {material Material{}}geometry Cylinder{radius 0.1 height 50}}]}\n",pos,ticz*i+10,pi/2);
+    }
+  }
+  
+  if(axis==3||axis==4){
+    if(axis==3)pos=0;
+    if(axis==4)pos=50;
+
+    fprintf(gpoutfile,"Transform {translation %g 0 0 children[Shape { appearance Appearance { material Material{}} geometry Sphere { radius 0.3 }}]}\n",pos);
+    fprintf(gpoutfile,"Transform {translation %g 50 0 children[Shape { appearance Appearance { material Material{}} geometry Sphere { radius 0.3 }}]}\n",pos);
+    fprintf(gpoutfile,"Transform {translation %g 0 40 children[Shape { appearance Appearance { material Material{}} geometry Sphere { radius 0.3 }}]}\n",pos);
+    fprintf(gpoutfile,"Transform {translation %g 50 40 children[Shape { appearance Appearance { material Material{}} geometry Sphere { radius 0.3 }}]}\n",pos);
+
+    fprintf(gpoutfile,"Transform {translation %g 25 0\n",pos);
+    fprintf(gpoutfile,"children[USE haxis]}\n");
+    fprintf(gpoutfile,"Transform {translation %g 25 40\n",pos);
+    fprintf(gpoutfile,"children[USE haxis]}\n");
+
+    fprintf(gpoutfile,"Transform {translation %g 0 20\n",pos);
+    fprintf(gpoutfile,"rotation 1 0 0 %g\n",pi/2);
+    fprintf(gpoutfile,"children[USE vaxis]}\n");
+    fprintf(gpoutfile,"Transform {translation %g 50 20\n",pos);
+    fprintf(gpoutfile,"rotation 1 0 0 %g\n",pi/2);
+    fprintf(gpoutfile,"children[USE vaxis]}\n");
+
+    for(i=1;ticy*i<50;i++){
+      fprintf(gpoutfile,"Transform {translation %g %g 20 rotation 1 0 0 %gchildren[Shape {appearance Appearance {material Material{}}geometry Cylinder{radius 0.1 height 40}}]}\n",pos,ticy*i,pi/2);
+    }
+    for(i=0;ticz*i<30;i++){
+      fprintf(gpoutfile,"Transform {translation %g 25 %g children[Shape {appearance Appearance {material Material{}}geometry Cylinder{radius 0.1 height 50}}]}\n",pos,ticz*i+10);
+    }
+  }
+  
+  if(axis==5||axis==6){
+    if(axis==5)
+      pos=0;
+    if(axis==6)
+	pos=40;
+
+    fprintf(gpoutfile,"Transform {translation 0 0 %g children[Shape { appearance Appearance { material Material{}} geometry Sphere { radius 0.3 }}]}\n",pos);
+    fprintf(gpoutfile,"Transform {translation 50 0 %g children[Shape { appearance Appearance { material Material{}} geometry Sphere { radius 0.3 }}]}\n",pos);
+    fprintf(gpoutfile,"Transform {translation 0 50 %g children[Shape { appearance Appearance { material Material{}} geometry Sphere { radius 0.3 }}]}\n",pos);
+    fprintf(gpoutfile,"Transform {translation 50 50 %g children[Shape { appearance Appearance { material Material{}} geometry Sphere { radius 0.3 }}]}\n",pos);
+
+    fprintf(gpoutfile,"Transform {translation 25 0 %g\n",pos);
+    fprintf(gpoutfile,"rotation 0 0 1 %g\n",pi/2);
+    fprintf(gpoutfile,"children[USE haxis]}\n");
+    fprintf(gpoutfile,"Transform {translation 25 50 %g\n",pos);
+    fprintf(gpoutfile,"rotation 0 0 1 %g\n",pi/2);
+    fprintf(gpoutfile,"children[USE haxis]}\n");
+
+    fprintf(gpoutfile,"Transform {translation 0 25 %g\n",pos);
+    fprintf(gpoutfile,"children[USE haxis]}\n");
+    fprintf(gpoutfile,"Transform {translation 50 25 %g\n",pos);
+    fprintf(gpoutfile,"children[USE haxis]}\n");
+
+    for(i=1;ticx*i<50;i++){
+      fprintf(gpoutfile,"Transform {translation 25 %g %g rotation 0 0 1 %gchildren[Shape {appearance Appearance {material Material{}}geometry Cylinder{radius 0.1 height 50}}]}\n",ticx*i,pos,pi/2);
+    }
+      for(i=1;ticy*i<50;i++){
+      fprintf(gpoutfile,"Transform {translation %g 25 %g children[Shape {appearance Appearance {material Material{}}geometry Cylinder{radius 0.1 height 50}}]}\n",ticy*i,pos);
+      }
+  }
+}
diff -Naur gnuplot-4.0.0/term/povray.trm gnuplot-4.0.0_povrml/term/povray.trm
--- gnuplot-4.0.0/term/povray.trm	1970-01-01 09:00:00.000000000 +0900
+++ gnuplot-4.0.0_povrml/term/povray.trm	2005-03-31 11:47:14.000000000 +0900
@@ -0,0 +1,152 @@
+/*
+ * povray.trm v0.3 2005/03/30
+ *
+ */
+
+/* GNUPLOT - povray.trm */
+
+/*
+ * This file is included by ../term.c.
+ *
+ * This terminal driver supports:
+ *   "Persistence of Vision Raytracer (POV-Ray) scene",
+ *
+ * AUTHORS
+ *  KITA Toshihiro  (http://t-kita.net/)
+ *  MIYATA Shigeo
+ * 
+ * send your comments or suggestions to (gnuplot-beta@lists.sourceforge.net).
+ * 
+ */
+
+#include "driver.h"
+
+#ifdef TERM_REGISTER
+register_term(povray)
+#endif
+
+
+#ifdef TERM_PROTO
+
+TERM_PUBLIC void POVRAY_options __PROTO ((void));
+TERM_PUBLIC void POVRAY_init __PROTO ((void));
+TERM_PUBLIC void POVRAY_reset __PROTO ((void));
+TERM_PUBLIC void POVRAY_text __PROTO ((void));
+TERM_PUBLIC void POVRAY_graphics __PROTO ((void));
+TERM_PUBLIC void POVRAY_move __PROTO ((unsigned int, unsigned int));
+TERM_PUBLIC void POVRAY_vector __PROTO ((unsigned int, unsigned int));
+TERM_PUBLIC void POVRAY_linetype __PROTO ((int));
+TERM_PUBLIC void POVRAY_put_text __PROTO ((unsigned int, unsigned int,
+const char str[]));
+TERM_PUBLIC void POVRAY_point __PROTO((unsigned int x, unsigned int y,
+int number));
+
+/* dummy values */
+#define POVRAY_XMAX 4096
+#define POVRAY_YMAX 4096
+
+#define POVRAY_XLAST (POVRAY_XMAX - 1)
+#define POVRAY_YLAST (POVRAY_YMAX - 1)
+
+#define POVRAY_VCHAR (POVRAY_YMAX/30)
+#define POVRAY_HCHAR (POVRAY_XMAX/60)
+#define POVRAY_VTIC (POVRAY_YMAX/80)
+#define POVRAY_HTIC (POVRAY_XMAX/80)
+
+#endif /*TERM_PROTO*/
+
+#ifndef TERM_PROTO_ONLY
+#ifdef TERM_BODY
+
+TERM_PUBLIC void
+POVRAY_init()
+{
+}
+
+TERM_PUBLIC void
+POVRAY_graphics()
+{
+}
+
+TERM_PUBLIC void
+POVRAY_text()
+{
+}
+
+TERM_PUBLIC void
+POVRAY_linetype(linetype)
+	int linetype;
+{
+}
+
+TERM_PUBLIC void
+POVRAY_move(x,y)
+	unsigned int x,y;
+{
+}
+
+TERM_PUBLIC void
+POVRAY_vector(ux, uy)
+unsigned int ux;
+unsigned int uy;
+{
+}
+
+TERM_PUBLIC void
+POVRAY_point(x, y, number)
+unsigned int x;
+unsigned int y;
+int number;
+{
+}
+
+
+TERM_PUBLIC void
+POVRAY_put_text(x,y,str)
+	unsigned int x,y;
+	const char str[];
+{
+}
+
+TERM_PUBLIC void
+POVRAY_reset()
+{
+}
+
+TERM_PUBLIC void
+POVRAY_options()
+{
+}
+
+#endif /* TERM_BODY */
+
+#ifdef TERM_TABLE
+TERM_TABLE_START(povray_driver)
+    "povray", "Persistence of Vision Raytracer scene",
+    POVRAY_XMAX, POVRAY_YMAX, POVRAY_VCHAR, POVRAY_HCHAR,
+    POVRAY_VTIC, POVRAY_HTIC, POVRAY_options, POVRAY_init, POVRAY_reset,
+    POVRAY_text, null_scale, POVRAY_graphics, POVRAY_move, POVRAY_vector,
+    POVRAY_linetype, POVRAY_put_text, null_text_angle,
+    null_justify_text, line_and_point, do_arrow, set_font_null
+TERM_TABLE_END(povray_driver)
+
+#undef LAST_TERM
+#define LAST_TERM povray_driver
+
+#endif /* TERM_TABLE */
+#endif /* TERM_PROTO_ONLY */
+
+
+#ifdef TERM_HELP
+START_HELP(povray)
+"1 povray",
+"?commands set terminal povray",
+"?set terminal povray",
+"?set term povray",
+"?terminal povray",
+"?term povray",
+"?povray",
+" This term is for generating POV-Ray scenes.",
+" It currently supports only splot."
+END_HELP(povray)
+#endif /*TERM_HELP*/
diff -Naur gnuplot-4.0.0/term/vrml.trm gnuplot-4.0.0_povrml/term/vrml.trm
--- gnuplot-4.0.0/term/vrml.trm	1970-01-01 09:00:00.000000000 +0900
+++ gnuplot-4.0.0_povrml/term/vrml.trm	2005-03-31 11:47:26.000000000 +0900
@@ -0,0 +1,151 @@
+/*
+ * vrml.trm v0.25 2005/03/30
+ *
+ */
+
+/* GNUPLOT - vrml.trm */
+
+/*
+ * This file is included by ../term.c.
+ *
+ * This terminal driver supports:
+ *   "VRML scenes",
+ *
+ * AUTHORS
+ *  KITA Toshihiro  (http://t-kita.net/)
+ *  MIYATA Shigeo
+ * 
+ * send your comments or suggestions to (gnuplot-beta@lists.sourceforge.net).
+ * 
+ */
+
+#include "driver.h"
+
+#ifdef TERM_REGISTER
+register_term(vrml)
+#endif
+
+
+#ifdef TERM_PROTO
+
+TERM_PUBLIC void VRML_options __PROTO ((void));
+TERM_PUBLIC void VRML_init __PROTO ((void));
+TERM_PUBLIC void VRML_reset __PROTO ((void));
+TERM_PUBLIC void VRML_text __PROTO ((void));
+TERM_PUBLIC void VRML_graphics __PROTO ((void));
+TERM_PUBLIC void VRML_move __PROTO ((unsigned int, unsigned int));
+TERM_PUBLIC void VRML_vector __PROTO ((unsigned int, unsigned int));
+TERM_PUBLIC void VRML_linetype __PROTO ((int));
+TERM_PUBLIC void VRML_put_text __PROTO ((unsigned int, unsigned int,
+const char str[]));
+TERM_PUBLIC void VRML_point __PROTO((unsigned int x, unsigned int y,
+int number));
+
+/* dummy values */
+#define VRML_XMAX 4096
+#define VRML_YMAX 4096
+
+#define VRML_XLAST (VRML_XMAX - 1)
+#define VRML_YLAST (VRML_YMAX - 1)
+
+#define VRML_VCHAR (VRML_YMAX/30)
+#define VRML_HCHAR (VRML_XMAX/60)
+#define VRML_VTIC (VRML_YMAX/80)
+#define VRML_HTIC (VRML_XMAX/80)
+
+#endif /*TERM_PROTO*/
+
+#ifndef TERM_PROTO_ONLY
+#ifdef TERM_BODY
+
+TERM_PUBLIC void
+VRML_init()
+{
+}
+
+TERM_PUBLIC void
+VRML_graphics()
+{
+}
+
+TERM_PUBLIC void
+VRML_text()
+{
+}
+
+TERM_PUBLIC void
+VRML_linetype(linetype)
+	int linetype;
+{
+}
+
+TERM_PUBLIC void
+VRML_move(x,y)
+	unsigned int x,y;
+{
+}
+
+TERM_PUBLIC void
+VRML_vector(ux, uy)
+unsigned int ux;
+unsigned int uy;
+{
+}
+
+TERM_PUBLIC void
+VRML_point(x, y, number)
+unsigned int x;
+unsigned int y;
+int number;
+{
+}
+
+
+TERM_PUBLIC void
+VRML_put_text(x,y,str)
+	unsigned int x,y;
+	const char str[];
+{
+}
+
+TERM_PUBLIC void
+VRML_reset()
+{
+}
+
+TERM_PUBLIC void
+VRML_options()
+{
+}
+
+#endif /* TERM_BODY */
+
+#ifdef TERM_TABLE
+TERM_TABLE_START(vrml_driver)
+    "vrml", "Virtual Reality Modeling Language",
+    VRML_XMAX, VRML_YMAX, VRML_VCHAR, VRML_HCHAR,
+    VRML_VTIC, VRML_HTIC, VRML_options, VRML_init, VRML_reset,
+    VRML_text, null_scale, VRML_graphics, VRML_move, VRML_vector,
+    VRML_linetype, VRML_put_text, null_text_angle,
+    null_justify_text, line_and_point, do_arrow, set_font_null
+TERM_TABLE_END(vrml_driver)
+
+#undef LAST_TERM
+#define LAST_TERM vrml_driver
+
+#endif/*TERM_TABLE*/
+#endif /* TERM_PROTO_ONLY */
+
+
+#ifdef TERM_HELP
+START_HELP(vrml)
+"1 vrml",
+"?commands set terminal vrml",
+"?set terminal vrml",
+"?set term vrml",
+"?terminal vrml",
+"?term vrml",
+"?vrml",
+" This term is for generating VRML scenes."
+END_HELP(vrml)
+#endif /*TERM_HELP*/
