changeset 41:834f8e778a65

Setup initial interface to vtkplot
author Jordi Gutiérrez Hermoso <jordigh@gmail.com>
date Fri, 12 Mar 2010 09:24:31 -0600
parents eaa99e09607d
children 3f8311cbf602
files src/include/vtkplot.hpp src/vtkplot.cpp
diffstat 2 files changed, 5 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/src/include/vtkplot.hpp
+++ b/src/include/vtkplot.hpp
@@ -19,13 +19,14 @@
    *               Delaunay triangulation will be done, and the
    *               third column is the value at this point.
    */
-  vtkplot(const interpolator<RBF>& data);
+  vtkplot(const interpolator<RBF>& u, 
+          bool offscreen = true);
   ///Defines the view direction when plotting.
   void set_view_direction(const vector& dir);
   ///Without changing the triangulation, update the values.
-  void update_values(const vector& values);
+  void update_values(const interpolator<RBF>& u);
   ///Enable offscreen plotting.
-  void plot_offscreen(bool yesno);
+  void plot_offscreen(bool offscreen = true);
   ///Set the base filename used for saving, to which numbers are appended.
   void set_base_filename(const std::string& basename);
   ///Actually do the plot, whether offscreen or onscreen.
--- a/src/vtkplot.cpp
+++ b/src/vtkplot.cpp
@@ -130,12 +130,6 @@
 void PlotPoints(vtkSmartPointer<vtkDelaunay2D> delaunay, 
                 bool offscreen);
 
-//int main ()
-//{
-//  TriangulateTerrain(&F);	
-//	return 0;
-//}
-
 void InitOffscreen(bool offscreen)
 {
   // Graphics Factory
@@ -150,14 +144,6 @@
   imaging_factory->SetUseMesaClasses( offscreen );
 }
 
-double sign(double x)
-{
-  if(x > 0)
-    return 1;
-  else
-    return -1;
-}
-
 vtkSmartPointer<vtkDelaunay2D> TriangulateTerrain(Func3d func)
 {
 
@@ -169,7 +155,7 @@
 	{
 		for(double y = -3; y < 3; y += 6.0/GridSize)
 		{
-      double r = sign(y)*sqrt(9-y*y)*sqrt(9-x*x)/3;
+      double r = sqrt(9-y*y)*sqrt(9-x*x)/3;
       double z = func(x,r,0);
 			vtkIdType idx = points->InsertNextPoint(x,r, z);
       scalars -> InsertTuple(idx, &z);