Răsfoiți Sursa

remove tab characters

David Rose 24 ani în urmă
părinte
comite
e5f4a81a7f
37 a modificat fișierele cu 720 adăugiri și 720 ștergeri
  1. 1 1
      pandaapp/src/stitch/stitchCommandProgram.h
  2. 1 1
      pandaapp/src/stitch/stitchImageProgram.h
  3. 1 1
      pandaapp/src/stitch/stitchViewerProgram.h
  4. 14 14
      pandaapp/src/stitchbase/layeredImage.cxx
  5. 2 2
      pandaapp/src/stitchbase/layeredImage.h
  6. 60 60
      pandaapp/src/stitchbase/morphGrid.cxx
  7. 15 15
      pandaapp/src/stitchbase/stitchCommand.cxx
  8. 2 2
      pandaapp/src/stitchbase/stitchCommand.h
  9. 2 2
      pandaapp/src/stitchbase/stitchCommandReader.cxx
  10. 1 1
      pandaapp/src/stitchbase/stitchCommandReader.h
  11. 8 8
      pandaapp/src/stitchbase/stitchCylindricalLens.cxx
  12. 5 5
      pandaapp/src/stitchbase/stitchCylindricalLens.h
  13. 71 71
      pandaapp/src/stitchbase/stitchFisheyeLens.cxx
  14. 10 10
      pandaapp/src/stitchbase/stitchFisheyeLens.h
  15. 16 16
      pandaapp/src/stitchbase/stitchImage.cxx
  16. 8 8
      pandaapp/src/stitchbase/stitchImage.h
  17. 2 2
      pandaapp/src/stitchbase/stitchImageCommandOutput.cxx
  18. 54 54
      pandaapp/src/stitchbase/stitchImageRasterizer.cxx
  19. 4 4
      pandaapp/src/stitchbase/stitchImageRasterizer.h
  20. 4 4
      pandaapp/src/stitchbase/stitchLens.cxx
  21. 10 10
      pandaapp/src/stitchbase/stitchLens.h
  22. 2 2
      pandaapp/src/stitchbase/stitchLexer.lxx
  23. 25 25
      pandaapp/src/stitchbase/stitchPSphereLens.cxx
  24. 10 10
      pandaapp/src/stitchbase/stitchPSphereLens.h
  25. 32 32
      pandaapp/src/stitchbase/stitchParser.h
  26. 82 82
      pandaapp/src/stitchbase/stitchParser.yxx
  27. 1 1
      pandaapp/src/stitchbase/stitchParserDefs.h
  28. 1 1
      pandaapp/src/stitchbase/stitchPerspectiveLens.cxx
  29. 56 56
      pandaapp/src/stitchbase/stitcher.cxx
  30. 1 1
      pandaapp/src/stitchbase/stitcher.h
  31. 3 3
      pandaapp/src/stitchbase/triangle.cxx
  32. 3 3
      pandaapp/src/stitchbase/triangle.h
  33. 189 189
      pandaapp/src/stitchbase/triangleRasterizer.cxx
  34. 11 11
      pandaapp/src/stitchbase/triangleRasterizer.h
  35. 8 8
      pandaapp/src/stitchviewer/stitchImageConverter.cxx
  36. 4 4
      pandaapp/src/stitchviewer/stitchImageVisualizer.cxx
  37. 1 1
      pandaapp/src/stitchviewer/stitchImageVisualizer.h

+ 1 - 1
pandaapp/src/stitch/stitchCommandProgram.h

@@ -11,7 +11,7 @@
 #include "stitchCommandReader.h"
 
 ////////////////////////////////////////////////////////////////////
-// 	 Class : StitchCommandProgram
+//       Class : StitchCommandProgram
 // Description : A program to read a stitch command file, process it
 //               without actually manipulating any images, and write
 //               the processed command file out.

+ 1 - 1
pandaapp/src/stitch/stitchImageProgram.h

@@ -11,7 +11,7 @@
 #include "stitchCommandReader.h"
 
 ////////////////////////////////////////////////////////////////////
-// 	 Class : StitchImageProgram
+//       Class : StitchImageProgram
 // Description : A program to read a stitch command file, perform the
 //               image manipulations in the CPU, and write output
 //               images for each processed image.

+ 1 - 1
pandaapp/src/stitch/stitchViewerProgram.h

@@ -11,7 +11,7 @@
 #include "stitchCommandReader.h"
 
 ////////////////////////////////////////////////////////////////////
-// 	 Class : StitchViewerProgram
+//       Class : StitchViewerProgram
 // Description : A program to read a stitch command file, and draw a
 //               3-d representation of all of the input images.
 ////////////////////////////////////////////////////////////////////

+ 14 - 14
pandaapp/src/stitchbase/layeredImage.cxx

@@ -115,12 +115,12 @@ trim() {
     
     for (int y = 0; y < ysize; y++) {
       for (int x = 0; x < xsize; x++) {
-	if (_data->get_alpha_val(x, y) != 0) {
-	  top = min(top, y);
-	  left = min(left, x);
-	  bottom = max(bottom, y);
-	  right = max(right, x);
-	}
+        if (_data->get_alpha_val(x, y) != 0) {
+          top = min(top, y);
+          left = min(left, x);
+          bottom = max(bottom, y);
+          right = max(right, x);
+        }
       }
     }
 
@@ -159,7 +159,7 @@ LayeredImage::
 
 void LayeredImage::
 add_layer(const string &name, const LVector2d &offset,
-	  PNMImage *data) {
+          PNMImage *data) {
   _layers.push_back(Layer());
   Layer &l = _layers.back();
 
@@ -326,8 +326,8 @@ xcf_save_layer_props(const LayeredImage::Layer &layer) {
   xcf_save_prop(PROP_MODE, 0);
 
   xcf_save_prop(PROP_OFFSETS, 
-		(int32_t)layer._offset[0], 
-		(int32_t)layer._offset[1]);
+                (int32_t)layer._offset[0], 
+                (int32_t)layer._offset[1]);
   xcf_save_prop(PROP_END);
 }
 
@@ -712,10 +712,10 @@ xcf_save_tile(const LayeredImage::TileManager &tm, int level, int tile) {
     int i = 0;
     for (int y = yoff; y < yoff + ysize; y++) {
       for (int x = xoff; x < xoff + xsize; x++) {
-	array[i++] = tm._data->get_red_val(x, y);
-	array[i++] = tm._data->get_green_val(x, y);
-	array[i++] = tm._data->get_blue_val(x, y);
-	array[i++] = 255;
+        array[i++] = tm._data->get_red_val(x, y);
+        array[i++] = tm._data->get_green_val(x, y);
+        array[i++] = tm._data->get_blue_val(x, y);
+        array[i++] = 255;
       }
     }
     assert(i == size);
@@ -728,7 +728,7 @@ xcf_save_tile(const LayeredImage::TileManager &tm, int level, int tile) {
     int i = 0;
     for (int y = yoff; y < yoff + ysize; y++) {
       for (int x = xoff; x < xoff + xsize; x++) {
-	array[i++] = tm._data->get_channel_val(x, y, tm._channel);
+        array[i++] = tm._data->get_channel_val(x, y, tm._channel);
       }
     }
     assert(i == size);

+ 2 - 2
pandaapp/src/stitchbase/layeredImage.h

@@ -26,7 +26,7 @@ public:
   ~LayeredImage();
 
   void add_layer(const string &name, const LVector2d &offset,
-		 PNMImage *data);
+                 PNMImage *data);
 
   bool write_file(const Filename &filename);
 
@@ -101,7 +101,7 @@ private:
   void xcf_save_prop(PropType prop_type, ...);
   void xcf_save_layer(const Layer &layer);
   void xcf_save_channel(const string &name, const PNMImage *image, 
-			int channel);
+                        int channel);
   void xcf_save_hierarchy(const PNMImage *image, int channel);
   void xcf_save_level(const TileManager &tm, int level);
   void xcf_save_tile(const TileManager &tm, int level, int tile);

+ 60 - 60
pandaapp/src/stitchbase/morphGrid.cxx

@@ -40,7 +40,7 @@ contains_point(const LPoint2d &p, TableType from) const {
   }
 
   return triangle_contains_point(p, _v[0]->_p[from], _v[1]->_p[from],
-				 _v[2]->_p[from]);
+                                 _v[2]->_p[from]);
 }
 
 LPoint2d MorphGrid::Triangle::
@@ -65,9 +65,9 @@ recompute() {
   for (int i = 0; i < (int)TT_num; i++) {
     for (int a = 0; a < 2; a++) {
       _min_p[i][a] = min(min(_v[0]->_p[i][a], _v[1]->_p[i][a]), 
-			 _v[2]->_p[i][a]);
+                         _v[2]->_p[i][a]);
       _max_p[i][a] = max(max(_v[0]->_p[i][a], _v[1]->_p[i][a]), 
-			 _v[2]->_p[i][a]);
+                         _v[2]->_p[i][a]);
     }
   
     LPoint2d origin = _v[1]->_p[i];
@@ -75,8 +75,8 @@ recompute() {
     LVector2d xaxis = _v[2]->_p[i] - origin;
     
     _mat[i] = LMatrix3d(xaxis[0], xaxis[1], 0.0,
-			yaxis[0], yaxis[1], 0.0,
-			origin[0], origin[1], 1.0);
+                        yaxis[0], yaxis[1], 0.0,
+                        origin[0], origin[1], 1.0);
     
     _inv[i] = invert(_mat[i]);
   }
@@ -112,10 +112,10 @@ recompute() {
 
     for (int i = 0; i < (int)TT_num; i++) {
       for (int a = 0; a < 2; a++) {
-	_min_p[i][a] =
-	  min(_u._tri[0]->_min_p[i][a], _u._tri[1]->_min_p[i][a]);
-	_max_p[i][a] =
-	  max(_u._tri[0]->_max_p[i][a], _u._tri[1]->_max_p[i][a]);
+        _min_p[i][a] =
+          min(_u._tri[0]->_min_p[i][a], _u._tri[1]->_min_p[i][a]);
+        _max_p[i][a] =
+          max(_u._tri[0]->_max_p[i][a], _u._tri[1]->_max_p[i][a]);
       }
     }
   } else {
@@ -124,10 +124,10 @@ recompute() {
 
     for (int i = 0; i < (int)TT_num; i++) {
       for (int a = 0; a < 2; a++) {
-	_min_p[i][a] = 
-	  min(_u._tree[0]->_min_p[i][a], _u._tree[1]->_min_p[i][a]);
-	_max_p[i][a] =
-	  max(_u._tree[0]->_max_p[i][a], _u._tree[1]->_max_p[i][a]);
+        _min_p[i][a] = 
+          min(_u._tree[0]->_min_p[i][a], _u._tree[1]->_min_p[i][a]);
+        _max_p[i][a] =
+          max(_u._tree[0]->_max_p[i][a], _u._tree[1]->_max_p[i][a]);
       }
     }
   }
@@ -209,7 +209,7 @@ init(int x_verts, int y_verts) {
     _table[y].reserve(_x_verts);
     for (x = 0; x < _x_verts; x++) {
       LPoint2d p((double)x / (double)(_x_verts - 1),
-		 1.0 - (double)y / (double)(_y_verts - 1));
+                 1.0 - (double)y / (double)(_y_verts - 1));
       _table[y].push_back(Vertex(p));
     }
   }
@@ -221,11 +221,11 @@ init(int x_verts, int y_verts) {
   for (y = 0; y + 1 < _y_verts; y++) {
     for (x = 0; x + 1 < _x_verts; x++) {
       _triangles.push_back(Triangle(&_table[y][x],
-				    &_table[y + 1][x],
-				    &_table[y + 1][x + 1]));
+                                    &_table[y + 1][x],
+                                    &_table[y + 1][x + 1]));
       _triangles.push_back(Triangle(&_table[y][x],
-				    &_table[y + 1][x + 1],
-				    &_table[y][x + 1]));
+                                    &_table[y + 1][x + 1],
+                                    &_table[y][x + 1]));
     }
   }
   assert((int)_triangles.size() == num_tris);
@@ -248,7 +248,7 @@ init(int x_verts, int y_verts) {
     tree[y].reserve(x_tree);
     for (x = 0; x < x_tree; x++) {
       tree[y].push_back(new TriangleTree(&_triangles[i],
-					 &_triangles[i + 1]));
+                                         &_triangles[i + 1]));
       i += 2;
     }
   }
@@ -264,13 +264,13 @@ init(int x_verts, int y_verts) {
       tx = 0;
       int fx = 0;
       while (fx + 1 < x_tree) {
-	tree[y][tx++] = new TriangleTree(tree[y][fx], tree[y][fx + 1]);
-	fx += 2;
+        tree[y][tx++] = new TriangleTree(tree[y][fx], tree[y][fx + 1]);
+        fx += 2;
       }
       if (fx < x_tree) {
-	// One more odd element remaining, just copy it up.
-	tree[y][tx++] = tree[y][fx];
-	fx++;
+        // One more odd element remaining, just copy it up.
+        tree[y][tx++] = tree[y][fx];
+        fx++;
       }
       assert(fx == x_tree);
     }
@@ -282,13 +282,13 @@ init(int x_verts, int y_verts) {
       ty = 0;
       int fy = 0;
       while (fy + 1 < y_tree) {
-	tree[ty++][x] = new TriangleTree(tree[fy][x], tree[fy + 1][x]);
-	fy += 2;
+        tree[ty++][x] = new TriangleTree(tree[fy][x], tree[fy + 1][x]);
+        fy += 2;
       }
       if (fy < y_tree) {
-	// One more odd element remaining, just copy it up.
-	tree[ty++][x] = tree[fy][x];
-	fy++;
+        // One more odd element remaining, just copy it up.
+        tree[ty++][x] = tree[fy][x];
+        fy++;
       }
       assert(fy == y_tree);
     }
@@ -319,9 +319,9 @@ fill_alpha() {
   for (y = 0; y < _y_verts && !found_interior; y++) {
     for (x = 0; x < _x_verts && !found_interior; x++) {
       if (!_table[y][x]._over_another) {
-	// Here's one!
-	found_interior = true;
-	count_dist_from_interior(x, y, 0);
+        // Here's one!
+        found_interior = true;
+        count_dist_from_interior(x, y, 0);
       }
     }
   }
@@ -346,36 +346,36 @@ fill_alpha() {
   for (y = 0; y < _y_verts; y++) {
     for (x = 0; x < _x_verts; x++) {
       if (!_table[y][x]._over_another) {
-	_table[y][x]._alpha = 1.0;
+        _table[y][x]._alpha = 1.0;
 
       } else {
-	int dist_from_edge = 
-	  min(min(x, y), 
-	      min(_x_verts - 1 - x, _y_verts - 1 - y));
-
-	assert(_table[y][x]._dist_from_interior >= 0);
-
-	// We subtract one from dist_from_interior to give us a bit of
-	// comfort zone around the interior edge--we're not precisely
-	// sure where the actual edge is.
-	int dist_from_interior = 
-	  max(_table[y][x]._dist_from_interior - 1, 0);
-
-	// Now if dist_from_edge is 0, it must be transparent; if
-	// dist_from_interior is 0, it must be opaque.  Any other
-	// combination should be some value in between.
-	if (dist_from_interior == 0) {
-	  _table[y][x]._alpha = 1.0;
-
-	} else if (dist_from_edge == 0) {
-	  _table[y][x]._alpha = 0.0;
-
-	} else {
-	  double ratio = (double)dist_from_interior /
-	    (double)(dist_from_interior + dist_from_edge);
-	  
-	  _table[y][x]._alpha = (cos(ratio * MathNumbers::pi) + 1.0) / 2.0;
-	}
+        int dist_from_edge = 
+          min(min(x, y), 
+              min(_x_verts - 1 - x, _y_verts - 1 - y));
+
+        assert(_table[y][x]._dist_from_interior >= 0);
+
+        // We subtract one from dist_from_interior to give us a bit of
+        // comfort zone around the interior edge--we're not precisely
+        // sure where the actual edge is.
+        int dist_from_interior = 
+          max(_table[y][x]._dist_from_interior - 1, 0);
+
+        // Now if dist_from_edge is 0, it must be transparent; if
+        // dist_from_interior is 0, it must be opaque.  Any other
+        // combination should be some value in between.
+        if (dist_from_interior == 0) {
+          _table[y][x]._alpha = 1.0;
+
+        } else if (dist_from_edge == 0) {
+          _table[y][x]._alpha = 0.0;
+
+        } else {
+          double ratio = (double)dist_from_interior /
+            (double)(dist_from_interior + dist_from_edge);
+
+          _table[y][x]._alpha = (cos(ratio * MathNumbers::pi) + 1.0) / 2.0;
+        }
       }
     }
   }

+ 15 - 15
pandaapp/src/stitchbase/stitchCommand.cxx

@@ -278,7 +278,7 @@ get_str() const {
 
 void StitchCommand::
 process(StitchImageOutputter &outputter, Stitcher *stitcher,
-	StitchFile &file) {
+        StitchFile &file) {
   if (_command == C_input_image) {
     StitchImage *image = create_image();
 
@@ -303,8 +303,8 @@ process(StitchImageOutputter &outputter, Stitcher *stitcher,
     // Now add all of the stitched images to the outputter, in order.
     Stitcher::Images::const_iterator ii;
     for (ii = new_stitcher->_placed.begin();
-	 ii != new_stitcher->_placed.end();
-	 ++ii) {
+         ii != new_stitcher->_placed.end();
+         ++ii) {
       outputter.add_input_image(*ii);
     }
     outputter.add_stitcher(new_stitcher);
@@ -372,19 +372,19 @@ write(ostream &out, int indent_level) const {
       Commands::const_iterator ci;
       ci = _using.begin();
       if (ci != _using.end()) {
-	out << " " << (*ci)->_name;
-	++ci;
-	while (ci != _using.end()) {
-	  out << ", " << (*ci)->_name;
-	  ++ci;
-	}
+        out << " " << (*ci)->_name;
+        ++ci;
+        while (ci != _using.end()) {
+          out << ", " << (*ci)->_name;
+          ++ci;
+        }
       }
     }
     if (_params & P_nested) {
       out << " {\n";
       Commands::const_iterator ci;
       for (ci = _nested.begin(); ci != _nested.end(); ++ci) {
-	(*ci)->write(out, indent_level + 2);
+        (*ci)->write(out, indent_level + 2);
       }
       indent(out, indent_level) << "}\n";
     } else {
@@ -400,7 +400,7 @@ find_definition(const string &name) {
   Commands::const_iterator ci;
   for (ci = _nested.begin(); ci != _nested.end(); ++ci) {
     if (((*ci)->_command == C_define || (*ci)->_command == C_lens) && 
-	(*ci)->_name == name) {
+        (*ci)->_name == name) {
       return (*ci);
     }
   }
@@ -417,7 +417,7 @@ find_using_lens() {
     for (ci = _using.begin(); ci != _using.end(); ++ci) {
       StitchLens *lens = (*ci)->find_lens();
       if (lens != NULL) {
-	return lens;
+        return lens;
       }
     }
   }
@@ -496,7 +496,7 @@ find_using_command(Command command) {
     for (ci = _using.begin(); ci != _using.end(); ++ci) {
       StitchCommand *cmd = (*ci)->find_command(command);
       if (cmd != NULL) {
-	return cmd;
+        return cmd;
       }
     }
   }
@@ -584,7 +584,7 @@ create_image() {
   if (cmd != NULL) {
     LVecBase2d size_mm = cmd->get_point2d();
     resolution.set((size_pixels[0]-1) / size_mm[0],
-		   (size_pixels[1]-1) / size_mm[1]);
+                   (size_pixels[1]-1) / size_mm[1]);
   } else {
     cmd = find_command(C_resolution);
     if (cmd != NULL) {
@@ -600,7 +600,7 @@ create_image() {
 
   StitchImage *image = 
     new StitchImage(get_name(), filename, lens, size_pixels, resolution,
-		    film_offset_mm);
+                    film_offset_mm);
   image->setup_grid(50, 50);
 
   // Also look for points and other stuff.

+ 2 - 2
pandaapp/src/stitchbase/stitchCommand.h

@@ -52,7 +52,7 @@ public:
   };
 
   StitchCommand(StitchCommand *parent = NULL, 
-		Command command = C_global);
+                Command command = C_global);
   ~StitchCommand();
 
   void clear();
@@ -80,7 +80,7 @@ public:
   StitchCommand *find_definition(const string &name);
 
   void process(StitchImageOutputter &outputter, Stitcher *stitcher,
-	       StitchFile &file);
+               StitchFile &file);
 
   void write(ostream &out, int indent) const;
 

+ 2 - 2
pandaapp/src/stitchbase/stitchCommandReader.cxx

@@ -26,12 +26,12 @@ bool StitchCommandReader::
 handle_args(ProgramBase::Args &args) {
   if (args.empty()) {
     nout << "You must specify the stitch command file to read on the\n"
-	 << "command line.\n";
+         << "command line.\n";
     return false;
   }
   if (args.size() > 1) {
     nout << "You must specify only one stitch command file to read on the\n"
-	 << "command line.\n";
+         << "command line.\n";
     return false;
   }
 

+ 1 - 1
pandaapp/src/stitchbase/stitchCommandReader.h

@@ -13,7 +13,7 @@
 #include <programBase.h>
 
 ////////////////////////////////////////////////////////////////////
-// 	 Class : StitchCommandReader
+//       Class : StitchCommandReader
 // Description : This specialization of ProgramBase is intended for
 //               programs in this directory that read and process a
 //               stitch command file.

+ 8 - 8
pandaapp/src/stitchbase/stitchCylindricalLens.cxx

@@ -45,7 +45,7 @@ get_hfov(double width_mm) const {
 double StitchCylindricalLens::
 get_vfov(double height_mm) const {
   return 2.0 * rad_2_deg(atan(height_mm / 
-			      (2.0 * get_focal_length(height_mm))));
+                              (2.0 * get_focal_length(height_mm))));
 }
 
 LVector3d StitchCylindricalLens::
@@ -54,8 +54,8 @@ extrude(const LPoint2d &point_mm, double width_mm) const {
 
   double fl = get_focal_length(width_mm);
   return LVector3d(sin(deg_2_rad(v2[0] * k / fl)) * fl,
-		   cos(deg_2_rad(v2[0] * k / fl)) * fl,
-		   v2[1]);
+                   cos(deg_2_rad(v2[0] * k / fl)) * fl,
+                   v2[1]);
 }
 
 
@@ -118,8 +118,8 @@ project_right(const LVector3d &vec, double width_mm) const {
 
 void StitchCylindricalLens::
 draw_triangle(TriangleRasterizer &rast, const LMatrix3d &mm_to_pixels,
-	      double width_mm, const RasterizerVertex *v0,
-	      const RasterizerVertex *v1, const RasterizerVertex *v2) {
+              double width_mm, const RasterizerVertex *v0,
+              const RasterizerVertex *v1, const RasterizerVertex *v2) {
   // A cylindrical lens has a seam at 180 and -180 degrees (regardless
   // of its field of view).  If the triangle crosses that seam, we'll
   // simply draw it twice: once at each side.
@@ -130,11 +130,11 @@ draw_triangle(TriangleRasterizer &rast, const LMatrix3d &mm_to_pixels,
   // quadrant IV.
 
   LVector2d xy0(dot(v0->_space, LVector3d::right()),
-		dot(v0->_space, LVector3d::forward()));
+                dot(v0->_space, LVector3d::forward()));
   LVector2d xy1(dot(v1->_space, LVector3d::right()),
-		dot(v1->_space, LVector3d::forward()));
+                dot(v1->_space, LVector3d::forward()));
   LVector2d xy2(dot(v2->_space, LVector3d::right()),
-		dot(v2->_space, LVector3d::forward()));
+                dot(v2->_space, LVector3d::forward()));
 
   if (xy0[1] >= 0.0 || xy1[1] >= 0.0 || xy2[1] >= 0.0) {
     // Some vertices are in quadrants I or II.

+ 5 - 5
pandaapp/src/stitchbase/stitchCylindricalLens.h

@@ -23,11 +23,11 @@ public:
   LPoint2d project_right(const LVector3d &vec, double width_mm) const; 
 
   virtual void draw_triangle(TriangleRasterizer &rast,
-			     const LMatrix3d &mm_to_pixels,
-			     double width_mm,
-			     const RasterizerVertex *v0, 
-			     const RasterizerVertex *v1, 
-			     const RasterizerVertex *v2);
+                             const LMatrix3d &mm_to_pixels,
+                             double width_mm,
+                             const RasterizerVertex *v0, 
+                             const RasterizerVertex *v1, 
+                             const RasterizerVertex *v2);
 
   virtual void make_lens_command(StitchCommand *parent);
 };

+ 71 - 71
pandaapp/src/stitchbase/stitchFisheyeLens.cxx

@@ -77,8 +77,8 @@ extrude(const LPoint2d &point_mm, double width_mm) const {
   
   // And rotate this point around the Y axis.
   LVector3d result = LVector3d::rfu(p[0]*v2[1] + p[2]*v2[0],
-				    p[1],
-				    p[2]*v2[1] - p[0]*v2[0]);
+                                    p[1],
+                                    p[2]*v2[1] - p[0]*v2[0]);
   return result;
 }
 
@@ -92,7 +92,7 @@ project(const LVector3d &vec, double width_mm) const {
     
   // First, discard the distance by normalizing the vector.
   LVector3d v2 = normalize(vec * LMatrix4d::convert_mat(CS_default,
-							CS_zup_right));
+                                                        CS_zup_right));
     
   // Now, project the point into the XZ plane and measure its angle
   // to the Z axis.  This is the same angle it will have to the
@@ -120,8 +120,8 @@ project(const LVector3d &vec, double width_mm) const {
 
 void StitchFisheyeLens::
 draw_triangle(TriangleRasterizer &rast, const LMatrix3d &,
-	      double, const RasterizerVertex *v0,
-	      const RasterizerVertex *v1, const RasterizerVertex *v2) {
+              double, const RasterizerVertex *v0,
+              const RasterizerVertex *v1, const RasterizerVertex *v2) {
   // A fisheye lens has a singularity at 180 degrees--this point maps
   // to the entire outer rim of the circle.  Near this singularity,
   // small distances in space map to very large distances on the film,
@@ -147,22 +147,22 @@ draw_triangle(TriangleRasterizer &rast, const LMatrix3d &,
       dot(v1->_space, LVector3d::forward()) < 0.0 &&
       dot(v2->_space, LVector3d::forward()) < 0.0) {
     LPoint2d xz0(dot(v0->_space, LVector3d::right()),
-		 dot(v0->_space, LVector3d::up()));
+                 dot(v0->_space, LVector3d::up()));
     LPoint2d xz1(dot(v1->_space, LVector3d::right()),
-		 dot(v1->_space, LVector3d::up()));
+                 dot(v1->_space, LVector3d::up()));
     LPoint2d xz2(dot(v2->_space, LVector3d::right()),
-		 dot(v2->_space, LVector3d::up()));
+                 dot(v2->_space, LVector3d::up()));
 
     // This projection will reverse the vertex order.
     if (triangle_contains_circle(LPoint2d(0.0, 0.0), 
-				 _singularity_radius,
-				 xz0, xz2, xz1)) {
+                                 _singularity_radius,
+                                 xz0, xz2, xz1)) {
       // The triangle does cross the singularity!  Reject it.
       /*
       nout << "Rejecting:\n"
-	   << "   " << v0->_space << "\n"
-	   << "   " << v1->_space << "\n"
-	   << "   " << v2->_space << "\n\n";
+           << "   " << v0->_space << "\n"
+           << "   " << v1->_space << "\n"
+           << "   " << v2->_space << "\n\n";
       */
       _singularity_detected = 1;
       return;
@@ -174,10 +174,10 @@ draw_triangle(TriangleRasterizer &rast, const LMatrix3d &,
 
 void StitchFisheyeLens::
 pick_up_singularity(TriangleRasterizer &rast, 
-		    const LMatrix3d &mm_to_pixels,
-		    const LMatrix3d &pixels_to_mm,
-		    const LMatrix3d &rotate,
-		    double width_mm, StitchImage *input) {
+                    const LMatrix3d &mm_to_pixels,
+                    const LMatrix3d &pixels_to_mm,
+                    const LMatrix3d &rotate,
+                    double width_mm, StitchImage *input) {
   if (_singularity_detected) {
     nout << "Picking up singularity\n";
 
@@ -218,52 +218,52 @@ pick_up_singularity(TriangleRasterizer &rast,
 
       // Where are the left and right X pixels at this slice?
       if (yi <= inner_top_y) {
-	// This is the top slice of the ring: between the top of the
-	// outer circle and the top of the inner circle.
-	
-	LPoint2d pmm = LPoint2d(0.0, yi) * pixels_to_mm;
-	pmm[0] = sqrt(outer_mm * outer_mm - pmm[1] * pmm[1]);
-	
-	LPoint2d px = LPoint2d(-pmm[0], pmm[1]) * mm_to_pixels;
-	left_x_1 = max((int)floor(px[0]), 0);
-       	px = LPoint2d(pmm[0], pmm[1]) * mm_to_pixels;
-	right_x_1 = min((int)ceil(px[0]), xsize - 1);
-
-	right_x_2 = right_x_1;
-	left_x_2 = right_x_2 + 1;
+        // This is the top slice of the ring: between the top of the
+        // outer circle and the top of the inner circle.
+
+        LPoint2d pmm = LPoint2d(0.0, yi) * pixels_to_mm;
+        pmm[0] = sqrt(outer_mm * outer_mm - pmm[1] * pmm[1]);
+
+        LPoint2d px = LPoint2d(-pmm[0], pmm[1]) * mm_to_pixels;
+        left_x_1 = max((int)floor(px[0]), 0);
+        px = LPoint2d(pmm[0], pmm[1]) * mm_to_pixels;
+        right_x_1 = min((int)ceil(px[0]), xsize - 1);
+
+        right_x_2 = right_x_1;
+        left_x_2 = right_x_2 + 1;
 
       } else if (yi < inner_bot_y) {
-	// This is the inner section: within the inner circle area.
-	// We have both a left and a right section here.
-	
-	LPoint2d pmm = LPoint2d(0.0, yi) * pixels_to_mm;
-	pmm[0] = sqrt(outer_mm * outer_mm - pmm[1] * pmm[1]);
-	
-	LPoint2d px = LPoint2d(-pmm[0], pmm[1]) * mm_to_pixels;
-	left_x_1 = max((int)floor(px[0]), 0);
-       	px = LPoint2d(pmm[0], pmm[1]) * mm_to_pixels;
-	right_x_2 = min((int)ceil(px[0]), xsize - 1);
-
-	pmm[0] = sqrt(inner_mm * inner_mm - pmm[1] * pmm[1]);
-	px = LPoint2d(-pmm[0], pmm[1]) * mm_to_pixels;
-	right_x_1 = max((int)floor(px[0]), 0);
-       	px = LPoint2d(pmm[0], pmm[1]) * mm_to_pixels;
-	left_x_2 = min((int)ceil(px[0]), xsize - 1);
+        // This is the inner section: within the inner circle area.
+        // We have both a left and a right section here.
+
+        LPoint2d pmm = LPoint2d(0.0, yi) * pixels_to_mm;
+        pmm[0] = sqrt(outer_mm * outer_mm - pmm[1] * pmm[1]);
+
+        LPoint2d px = LPoint2d(-pmm[0], pmm[1]) * mm_to_pixels;
+        left_x_1 = max((int)floor(px[0]), 0);
+        px = LPoint2d(pmm[0], pmm[1]) * mm_to_pixels;
+        right_x_2 = min((int)ceil(px[0]), xsize - 1);
+
+        pmm[0] = sqrt(inner_mm * inner_mm - pmm[1] * pmm[1]);
+        px = LPoint2d(-pmm[0], pmm[1]) * mm_to_pixels;
+        right_x_1 = max((int)floor(px[0]), 0);
+        px = LPoint2d(pmm[0], pmm[1]) * mm_to_pixels;
+        left_x_2 = min((int)ceil(px[0]), xsize - 1);
 
       } else {
-	// This is the bottom slice of the ring: between the bottom of
-	// the inner circle and the bottom of the outer circle.
-	
-	LPoint2d pmm = LPoint2d(0.0, yi) * pixels_to_mm;
-	pmm[0] = sqrt(outer_mm * outer_mm - pmm[1] * pmm[1]);
-	
-	LPoint2d px = LPoint2d(-pmm[0], pmm[1]) * mm_to_pixels;
-	left_x_1 = max((int)floor(px[0]), 0);
-       	px = LPoint2d(pmm[0], pmm[1]) * mm_to_pixels;
-	right_x_1 = min((int)ceil(px[0]), xsize - 1);
-
-	right_x_2 = right_x_1;
-	left_x_2 = right_x_2 + 1;
+        // This is the bottom slice of the ring: between the bottom of
+        // the inner circle and the bottom of the outer circle.
+
+        LPoint2d pmm = LPoint2d(0.0, yi) * pixels_to_mm;
+        pmm[0] = sqrt(outer_mm * outer_mm - pmm[1] * pmm[1]);
+
+        LPoint2d px = LPoint2d(-pmm[0], pmm[1]) * mm_to_pixels;
+        left_x_1 = max((int)floor(px[0]), 0);
+        px = LPoint2d(pmm[0], pmm[1]) * mm_to_pixels;
+        right_x_1 = min((int)ceil(px[0]), xsize - 1);
+
+        right_x_2 = right_x_1;
+        left_x_2 = right_x_2 + 1;
 
       }
 
@@ -273,12 +273,12 @@ pick_up_singularity(TriangleRasterizer &rast,
       v0._uv = input->project(v0._space);
       
       for (xi = left_x_1; xi <= right_x_1; xi++) {
-	double last_u = v0._uv[0];
-	
-	v0._p.set(xi, yi);
-	v0._space = extrude(v0._p * pixels_to_mm, width_mm) * rotate;
-	v0._uv = input->project(v0._space);
-	rast.draw_pixel(&v0, fabs(v0._uv[0] - last_u));
+        double last_u = v0._uv[0];
+
+        v0._p.set(xi, yi);
+        v0._space = extrude(v0._p * pixels_to_mm, width_mm) * rotate;
+        v0._uv = input->project(v0._space);
+        rast.draw_pixel(&v0, fabs(v0._uv[0] - last_u));
       }
 
       // Project xi point 1 to determine the radius.
@@ -287,12 +287,12 @@ pick_up_singularity(TriangleRasterizer &rast,
       v0._uv = input->project(v0._space);
       
       for (xi = left_x_2; xi <= right_x_2; xi++) {
-	double last_u = v0._uv[0];
-	
-	v0._p.set(xi, yi);
-	v0._space = extrude(v0._p * pixels_to_mm, width_mm) * rotate;
-	v0._uv = input->project(v0._space);
-	rast.draw_pixel(&v0, fabs(v0._uv[0] - last_u));
+        double last_u = v0._uv[0];
+
+        v0._p.set(xi, yi);
+        v0._space = extrude(v0._p * pixels_to_mm, width_mm) * rotate;
+        v0._uv = input->project(v0._space);
+        rast.draw_pixel(&v0, fabs(v0._uv[0] - last_u));
       }
     }
   }

+ 10 - 10
pandaapp/src/stitchbase/stitchFisheyeLens.h

@@ -19,18 +19,18 @@ public:
   virtual LPoint2d project(const LVector3d &vec, double width_mm) const; 
 
   virtual void draw_triangle(TriangleRasterizer &rast,
-			     const LMatrix3d &mm_to_pixels,
-			     double width_mm,
-			     const RasterizerVertex *v0, 
-			     const RasterizerVertex *v1, 
-			     const RasterizerVertex *v2);
+                             const LMatrix3d &mm_to_pixels,
+                             double width_mm,
+                             const RasterizerVertex *v0, 
+                             const RasterizerVertex *v1, 
+                             const RasterizerVertex *v2);
 
   virtual void pick_up_singularity(TriangleRasterizer &rast, 
-				   const LMatrix3d &mm_to_pixels,
-				   const LMatrix3d &pixels_to_mm,
-				   const LMatrix3d &rotate,
-				   double width_mm,
-				   StitchImage *input);
+                                   const LMatrix3d &mm_to_pixels,
+                                   const LMatrix3d &pixels_to_mm,
+                                   const LMatrix3d &rotate,
+                                   double width_mm,
+                                   StitchImage *input);
 
   virtual void make_lens_command(StitchCommand *parent);
 };

+ 16 - 16
pandaapp/src/stitchbase/stitchImage.cxx

@@ -12,9 +12,9 @@
 
 StitchImage::
 StitchImage(const string &name, const string &filename,
-	    StitchLens *lens, const LVecBase2d &size_pixels,
-	    const LVecBase2d &pixels_per_mm,
-	    const LVecBase2d &film_offset_mm) :
+            StitchLens *lens, const LVecBase2d &size_pixels,
+            const LVecBase2d &pixels_per_mm,
+            const LVecBase2d &film_offset_mm) :
   _lens(lens),
   _size_pixels(size_pixels),
   _pixels_per_mm(pixels_per_mm),
@@ -25,7 +25,7 @@ StitchImage(const string &name, const string &filename,
   _name(name)
 {
   _size_mm.set((_size_pixels[0] - 1.0) / _pixels_per_mm[0],
-	       (_size_pixels[1] - 1.0) / _pixels_per_mm[1]);
+               (_size_pixels[1] - 1.0) / _pixels_per_mm[1]);
 
   // There are several coordinate systems to talk about points on the
   // image.
@@ -177,11 +177,11 @@ close_layer(bool nonempty) {
       result = false;
     } else {
       if (nonempty) {
-	char buff[1024];
-	_layer_index++;
-	sprintf(buff, _filename.c_str(), _layer_index);
-	nout << "Writing layer " << _layer_name << " as " << buff << "\n";
-	result = _data->write(buff);
+        char buff[1024];
+        _layer_index++;
+        sprintf(buff, _filename.c_str(), _layer_index);
+        nout << "Writing layer " << _layer_name << " as " << buff << "\n";
+        result = _data->write(buff);
       }
     }
     clear_file();
@@ -191,9 +191,9 @@ close_layer(bool nonempty) {
       result = false;
     } else {
       if (nonempty) {
-	_layered_image->add_layer(_layer_name, LVector2d(0.0, 0.0),
-				  _data);
-	_data = NULL;
+        _layered_image->add_layer(_layer_name, LVector2d(0.0, 0.0),
+                                  _data);
+        _data = NULL;
       }
     }
   }
@@ -274,8 +274,8 @@ get_y_verts() const {
 LPoint2d StitchImage::
 get_grid_uv(int xv, int yv) {
   return LPoint2d((double)xv / (double)(_x_verts - 1),
-		  1.0 - (double)yv / (double)(_y_verts - 1));
-		  
+                  1.0 - (double)yv / (double)(_y_verts - 1));
+
 }
 
 LVector3d StitchImage::
@@ -322,14 +322,14 @@ reset_singularity_detected() {
 
 void StitchImage::
 draw_triangle(TriangleRasterizer &rast, const RasterizerVertex *v0, 
-	      const RasterizerVertex *v1, const RasterizerVertex *v2) {
+              const RasterizerVertex *v1, const RasterizerVertex *v2) {
   _lens->draw_triangle(rast, _mm_to_pixels, _size_mm[0], v0, v1, v2);
 }
 
 void StitchImage::
 pick_up_singularity(TriangleRasterizer &rast, StitchImage *input) {
   _lens->pick_up_singularity(rast, _mm_to_pixels, _pixels_to_mm, 
-			     _rotate, _size_mm[0], input);
+                             _rotate, _size_mm[0], input);
 }
 
 void StitchImage::

+ 8 - 8
pandaapp/src/stitchbase/stitchImage.h

@@ -26,10 +26,10 @@ class LayeredImage;
 class StitchImage {
 public:
   StitchImage(const string &name, const string &filename,
-	      StitchLens *lens, 
-	      const LVecBase2d &size_pixels,
-	      const LVecBase2d &pixels_per_mm,
-	      const LVecBase2d &film_offset_mm);
+              StitchLens *lens, 
+              const LVecBase2d &size_pixels,
+              const LVecBase2d &pixels_per_mm,
+              const LVecBase2d &film_offset_mm);
 
   bool has_name() const;
   string get_name() const;
@@ -81,16 +81,16 @@ public:
   // something special if the triangle crosses a seam or singularity
   // in the lens' coordinate space.
   void draw_triangle(TriangleRasterizer &rast,
-		     const RasterizerVertex *v0, 
-		     const RasterizerVertex *v1, 
-		     const RasterizerVertex *v2);
+                     const RasterizerVertex *v0, 
+                     const RasterizerVertex *v1, 
+                     const RasterizerVertex *v2);
 
   // This function is to be called after all triangles have been
   // drawn; it will draw pixel-by-pixel all the points within
   // _singularity_radius of any singularity points the lens may have
   // (these points were not draw by draw_triangle(), above).
   void pick_up_singularity(TriangleRasterizer &rast,
-			   StitchImage *input);
+                           StitchImage *input);
 
   void add_point(const string &name, const LPoint2d &pixel);
 

+ 2 - 2
pandaapp/src/stitchbase/stitchImageCommandOutput.cxx

@@ -41,8 +41,8 @@ execute() {
     Stitcher *stitcher = (*si);
     Stitcher::LoosePoints::const_iterator pi;
     for (pi = stitcher->_loose_points.begin();
-	 pi != stitcher->_loose_points.end();
-	 ++pi) {
+         pi != stitcher->_loose_points.end();
+         ++pi) {
       StitchCommand *cmd = new StitchCommand(&root, StitchCommand::C_point3d);
       cmd->set_name((*pi)->_name);
       cmd->set_point3d((*pi)->_space);

+ 54 - 54
pandaapp/src/stitchbase/stitchImageRasterizer.cxx

@@ -44,33 +44,33 @@ execute() {
 
       Images::const_iterator ii;
       for (ii = _input_images.begin(); ii != _input_images.end(); ++ii) {
-	StitchImage *input = (*ii);
-	draw_image(output, input);
+        StitchImage *input = (*ii);
+        draw_image(output, input);
       }
 
       output->open_layer("points");
       bool shown_points = false;
       Stitchers::const_iterator si;
       for (si = _stitchers.begin(); si != _stitchers.end(); ++si) {
-	Stitcher *stitcher = (*si);
-	if (stitcher->_show_points && !stitcher->_loose_points.empty()) {
-	  draw_points(output, stitcher, stitcher->_point_color,
-		      stitcher->_point_radius);
-	  shown_points = true;
-	}
+        Stitcher *stitcher = (*si);
+        if (stitcher->_show_points && !stitcher->_loose_points.empty()) {
+          draw_points(output, stitcher, stitcher->_point_color,
+                      stitcher->_point_radius);
+          shown_points = true;
+        }
       }
       for (ii = _input_images.begin(); ii != _input_images.end(); ++ii) {
-	StitchImage *input = (*ii);
-	if (input->_show_points && !input->_points.empty()) {
-	  draw_points(output, input, input->_point_color,
-		      input->_point_radius);
-	  shown_points = true;
-	}
+        StitchImage *input = (*ii);
+        if (input->_show_points && !input->_points.empty()) {
+          draw_points(output, input, input->_point_color,
+                      input->_point_radius);
+          shown_points = true;
+        }
       }
       output->close_layer(shown_points);
       
       if (!output->close_output_file()) {
-	nout << "Error in writing.\n";
+        nout << "Error in writing.\n";
       }
     }
   }
@@ -78,7 +78,7 @@ execute() {
   
 void StitchImageRasterizer::
 draw_points(StitchImage *output, StitchImage *input,
-	    const Colord &color, double radius) {
+            const Colord &color, double radius) {
   StitchImage::Points::const_iterator pi;
   for (pi = input->_points.begin(); pi != input->_points.end(); ++pi) {
     LPoint2d to = output->project(input->extrude((*pi).second));
@@ -88,7 +88,7 @@ draw_points(StitchImage *output, StitchImage *input,
   
 void StitchImageRasterizer::
 draw_points(StitchImage *output, Stitcher *input,
-	    const Colord &color, double radius) {
+            const Colord &color, double radius) {
   Stitcher::LoosePoints::const_iterator pi;
   for (pi = input->_loose_points.begin(); 
        pi != input->_loose_points.end(); ++pi) {
@@ -138,14 +138,14 @@ draw_image(StitchImage *output, StitchImage *input) {
       // bounds.  If all three vertices of a triangle are out in the
       // same quadrant, then the entire triangle is out of bounds.
       _table[xi][yi]._visibility =
-	((to[0] < 0.0) |
-	 ((to[0] > 1.0) << 1) |
-	 ((to[1] < 0.0) << 2) |
-	 ((to[1] > 1.0) << 3) |
-	 ((from[0] < 0.0) << 4) |
-	 ((from[0] > 1.0) << 5) |
-	 ((from[1] < 0.0) << 6) |
-	 ((from[1] > 1.0) << 7));
+        ((to[0] < 0.0) |
+         ((to[0] > 1.0) << 1) |
+         ((to[1] < 0.0) << 2) |
+         ((to[1] > 1.0) << 3) |
+         ((from[0] < 0.0) << 4) |
+         ((from[0] > 1.0) << 5) |
+         ((from[1] < 0.0) << 6) |
+         ((from[1] > 1.0) << 7));
     }
   }
 
@@ -155,13 +155,13 @@ draw_image(StitchImage *output, StitchImage *input) {
   for (yi = 0; yi < y_verts - 1; yi++) {
     for (xi = 0; xi < x_verts - 1; xi++) {
       output->draw_triangle(rast,
-			    &_table[xi][yi],
-			    &_table[xi][yi + 1],
-			    &_table[xi + 1][yi + 1]);
+                            &_table[xi][yi],
+                            &_table[xi][yi + 1],
+                            &_table[xi + 1][yi + 1]);
       output->draw_triangle(rast,
-			    &_table[xi][yi],
-			    &_table[xi + 1][yi + 1],
-			    &_table[xi + 1][yi]);
+                            &_table[xi][yi],
+                            &_table[xi + 1][yi + 1],
+                            &_table[xi + 1][yi]);
     }
   }
   output->pick_up_singularity(rast, input);
@@ -173,7 +173,7 @@ draw_image(StitchImage *output, StitchImage *input) {
 
 void StitchImageRasterizer::
 draw_spot(StitchImage *output,
-	  const LPoint2d pixel_center, const Colord &color, double radius) {
+          const LPoint2d pixel_center, const Colord &color, double radius) {
   LPoint2d minp = pixel_center - LPoint2d(radius, radius);
   LPoint2d maxp = pixel_center + LPoint2d(radius, radius);
   
@@ -188,28 +188,28 @@ draw_spot(StitchImage *output,
   for (int yi = min_y; yi <= max_y; yi++) {
     if (yi >= 0 && yi < output->_data->get_y_size()) {
       for (int xi = min_x; xi <= max_x; xi++) {
-	if (xi >= 0 && xi < output->_data->get_x_size()) {
-	  // Check the coverage of the four points around the pixel, and
-	  // the pixel center.
-	  LPoint2d ul = pixel_center - LPoint2d(xi - 0.5, yi - 0.5);
-	  LPoint2d ll = pixel_center - LPoint2d(xi - 0.5, yi + 0.5);
-	  LPoint2d ur = pixel_center - LPoint2d(xi + 0.5, yi - 0.5);
-	  LPoint2d lr = pixel_center - LPoint2d(xi + 0.5, yi + 0.5);
-	  LPoint2d pc = pixel_center - LPoint2d(xi, yi);
-	  
-	  // Net coverage.
-	  int coverage =
-	    (dot(ul, ul) <= r2) +
-	    (dot(ll, ll) <= r2) +
-	    (dot(ur, ur) <= r2) +
-	    (dot(lr, lr) <= r2) +
-	    (dot(pc, pc) <= r2);
-	  
-	  if (coverage != 0) {
-	    output->_data->blend(xi, yi, color[0], color[1], color[2],
-				 color[3] * (double)coverage / 5.0);
-	  }
-	}
+        if (xi >= 0 && xi < output->_data->get_x_size()) {
+          // Check the coverage of the four points around the pixel, and
+          // the pixel center.
+          LPoint2d ul = pixel_center - LPoint2d(xi - 0.5, yi - 0.5);
+          LPoint2d ll = pixel_center - LPoint2d(xi - 0.5, yi + 0.5);
+          LPoint2d ur = pixel_center - LPoint2d(xi + 0.5, yi - 0.5);
+          LPoint2d lr = pixel_center - LPoint2d(xi + 0.5, yi + 0.5);
+          LPoint2d pc = pixel_center - LPoint2d(xi, yi);
+
+          // Net coverage.
+          int coverage =
+            (dot(ul, ul) <= r2) +
+            (dot(ll, ll) <= r2) +
+            (dot(ur, ur) <= r2) +
+            (dot(lr, lr) <= r2) +
+            (dot(pc, pc) <= r2);
+
+          if (coverage != 0) {
+            output->_data->blend(xi, yi, color[0], color[1], color[2],
+                                 color[3] * (double)coverage / 5.0);
+          }
+        }
       }
     }
   }

+ 4 - 4
pandaapp/src/stitchbase/stitchImageRasterizer.h

@@ -27,9 +27,9 @@ public:
   
 protected:
   void draw_points(StitchImage *output, StitchImage *input,
-		   const Colord &color, double radius);
+                   const Colord &color, double radius);
   void draw_points(StitchImage *output, Stitcher *input,
-		   const Colord &color, double radius);
+                   const Colord &color, double radius);
   void draw_image(StitchImage *output, StitchImage *input);
 
   typedef vector<StitchImage *> Images;
@@ -41,8 +41,8 @@ protected:
 
 protected:
   void draw_spot(StitchImage *output,
-		 const LPoint2d pixel_center, const Colord &color,
-		 double radius);
+                 const LPoint2d pixel_center, const Colord &color,
+                 double radius);
 };
 
 #endif

+ 4 - 4
pandaapp/src/stitchbase/stitchLens.cxx

@@ -57,13 +57,13 @@ get_vfov(double height_mm) const {
 
 void StitchLens::
 draw_triangle(TriangleRasterizer &rast, const LMatrix3d &,
-	      double, const RasterizerVertex *v0,
-	      const RasterizerVertex *v1, const RasterizerVertex *v2) {
+              double, const RasterizerVertex *v0,
+              const RasterizerVertex *v1, const RasterizerVertex *v2) {
   rast.draw_triangle(v0, v1, v2);
 }
 
 void StitchLens::
 pick_up_singularity(TriangleRasterizer &, const LMatrix3d &, 
-		    const LMatrix3d &, const LMatrix3d &, 
-		    double, StitchImage *) {
+                    const LMatrix3d &, const LMatrix3d &, 
+                    double, StitchImage *) {
 }

+ 10 - 10
pandaapp/src/stitchbase/stitchLens.h

@@ -37,22 +37,22 @@ public:
   // something special if the triangle crosses a seam or singularity
   // in the lens' coordinate space.
   virtual void draw_triangle(TriangleRasterizer &rast,
-			     const LMatrix3d &mm_to_pixels,
-			     double width_mm,
-			     const RasterizerVertex *v0, 
-			     const RasterizerVertex *v1, 
-			     const RasterizerVertex *v2);
+                             const LMatrix3d &mm_to_pixels,
+                             double width_mm,
+                             const RasterizerVertex *v0, 
+                             const RasterizerVertex *v1, 
+                             const RasterizerVertex *v2);
 
   // This function is to be called after all triangles have been
   // drawn; it will draw pixel-by-pixel all the points within
   // _singularity_radius of any singularity points the lens may have
   // (these points were not draw by draw_triangle(), above).
   virtual void pick_up_singularity(TriangleRasterizer &rast, 
-				   const LMatrix3d &mm_to_pixels,
-				   const LMatrix3d &pixels_to_mm,
-				   const LMatrix3d &rotate,
-				   double width_mm,
-				   StitchImage *input);
+                                   const LMatrix3d &mm_to_pixels,
+                                   const LMatrix3d &pixels_to_mm,
+                                   const LMatrix3d &rotate,
+                                   double width_mm,
+                                   StitchImage *input);
 
   // This generates a StitchCommand that represents the given lens.
   virtual void make_lens_command(StitchCommand *parent)=0;

+ 2 - 2
pandaapp/src/stitchbase/stitchLexer.lxx

@@ -135,7 +135,7 @@ input_chars(char *buffer, int &result, int max_size) {
       // Truncate it at the newline.
       char *end = strchr(current_line, '\n');
       if (end != NULL) {
-	*end = '\0';
+        *end = '\0';
       }
     }
 
@@ -215,7 +215,7 @@ eat_c_comment() {
     if (last_c == '/' && c == '*') {
       ostringstream errmsg;
       errmsg << "This comment contains a nested /* symbol at line "
-	     << line << ", column " << col-1 << "--possibly unclosed?";
+             << line << ", column " << col-1 << "--possibly unclosed?";
       stitchyywarning(errmsg);
     }
     last_c = c;

+ 25 - 25
pandaapp/src/stitchbase/stitchPSphereLens.cxx

@@ -124,8 +124,8 @@ project_right(const LVector3d &vec, double width_mm) const {
 
 void StitchPSphereLens::
 draw_triangle(TriangleRasterizer &rast, const LMatrix3d &mm_to_pixels,
-	      double width_mm, const RasterizerVertex *v0,
-	      const RasterizerVertex *v1, const RasterizerVertex *v2) {
+              double width_mm, const RasterizerVertex *v0,
+              const RasterizerVertex *v1, const RasterizerVertex *v2) {
   // A PSphere lens has two singularities, at the north and south
   // poles, as well as a seam at 180 and -180 degrees.
 
@@ -133,11 +133,11 @@ draw_triangle(TriangleRasterizer &rast, const LMatrix3d &mm_to_pixels,
   // either pole, similar to the fisheye lens.
 
   LVector2d xy0(dot(v0->_space, LVector3d::right()),
-		dot(v0->_space, LVector3d::forward()));
+                dot(v0->_space, LVector3d::forward()));
   LVector2d xy1(dot(v1->_space, LVector3d::right()),
-		dot(v1->_space, LVector3d::forward()));
+                dot(v1->_space, LVector3d::forward()));
   LVector2d xy2(dot(v2->_space, LVector3d::right()),
-		dot(v2->_space, LVector3d::forward()));
+                dot(v2->_space, LVector3d::forward()));
 
   double z0 = dot(v0->_space, LVector3d::up());
   double z1 = dot(v0->_space, LVector3d::up());
@@ -147,8 +147,8 @@ draw_triangle(TriangleRasterizer &rast, const LMatrix3d &mm_to_pixels,
     // A triangle on the southern hemisphere.  This projection will
     // reverse the vertex order.
     if (triangle_contains_circle(LPoint2d(0.0, 0.0), 
-				 _singularity_radius,
-				 xy0, xy2, xy1)) {
+                                 _singularity_radius,
+                                 xy0, xy2, xy1)) {
       // The triangle does cross the singularity!  Reject it.
       _singularity_detected |= 1;
       return;
@@ -157,8 +157,8 @@ draw_triangle(TriangleRasterizer &rast, const LMatrix3d &mm_to_pixels,
     // A triangle on the northern hemisphere.  This projection will
     // preserve the vertex order.
     if (triangle_contains_circle(LPoint2d(0.0, 0.0), 
-				 _singularity_radius,
-				 xy0, xy1, xy2)) {
+                                 _singularity_radius,
+                                 xy0, xy1, xy2)) {
       // The triangle does cross the singularity!  Reject it.
       _singularity_detected |= 2;
       return;
@@ -206,10 +206,10 @@ draw_triangle(TriangleRasterizer &rast, const LMatrix3d &mm_to_pixels,
 
 void StitchPSphereLens::
 pick_up_singularity(TriangleRasterizer &rast, 
-		    const LMatrix3d &mm_to_pixels,
-		    const LMatrix3d &pixels_to_mm,
-		    const LMatrix3d &rotate,
-		    double width_mm, StitchImage *input) {
+                    const LMatrix3d &mm_to_pixels,
+                    const LMatrix3d &pixels_to_mm,
+                    const LMatrix3d &rotate,
+                    double width_mm, StitchImage *input) {
   if (_singularity_detected & 2) {
     nout << "Picking up north pole singularity\n";
     // Determine what the bottom y pixel is of the circle around the
@@ -237,12 +237,12 @@ pick_up_singularity(TriangleRasterizer &rast,
       v0._uv = input->project(v0._space);
       
       for (xi = 0; xi < xsize; xi++) {
-	double last_u = v0._uv[0];
-	
-	v0._p.set(xi, yi);
-	v0._space = extrude(v0._p * pixels_to_mm, width_mm) * rotate;
-	v0._uv = input->project(v0._space);
-	rast.draw_pixel(&v0, fabs(v0._uv[0] - last_u));
+        double last_u = v0._uv[0];
+
+        v0._p.set(xi, yi);
+        v0._space = extrude(v0._p * pixels_to_mm, width_mm) * rotate;
+        v0._uv = input->project(v0._space);
+        rast.draw_pixel(&v0, fabs(v0._uv[0] - last_u));
       }
     }
   }
@@ -273,12 +273,12 @@ pick_up_singularity(TriangleRasterizer &rast,
       v0._uv = input->project(v0._space);
       
       for (xi = 0; xi < xsize; xi++) {
-	double last_u = v0._uv[0];
-	
-	v0._p.set(xi, yi);
-	v0._space = extrude(v0._p * pixels_to_mm, width_mm) * rotate;
-	v0._uv = input->project(v0._space);
-	rast.draw_pixel(&v0, fabs(v0._uv[0] - last_u));
+        double last_u = v0._uv[0];
+
+        v0._p.set(xi, yi);
+        v0._space = extrude(v0._p * pixels_to_mm, width_mm) * rotate;
+        v0._uv = input->project(v0._space);
+        rast.draw_pixel(&v0, fabs(v0._uv[0] - last_u));
       }
     }
   }

+ 10 - 10
pandaapp/src/stitchbase/stitchPSphereLens.h

@@ -22,18 +22,18 @@ public:
   LPoint2d project_right(const LVector3d &vec, double width_mm) const; 
 
   virtual void draw_triangle(TriangleRasterizer &rast,
-			     const LMatrix3d &mm_to_pixels,
-			     double width_mm,
-			     const RasterizerVertex *v0, 
-			     const RasterizerVertex *v1, 
-			     const RasterizerVertex *v2);
+                             const LMatrix3d &mm_to_pixels,
+                             double width_mm,
+                             const RasterizerVertex *v0, 
+                             const RasterizerVertex *v1, 
+                             const RasterizerVertex *v2);
 
   virtual void pick_up_singularity(TriangleRasterizer &rast, 
-				   const LMatrix3d &mm_to_pixels,
-				   const LMatrix3d &pixels_to_mm,
-				   const LMatrix3d &rotate,
-				   double width_mm,
-				   StitchImage *input);
+                                   const LMatrix3d &mm_to_pixels,
+                                   const LMatrix3d &pixels_to_mm,
+                                   const LMatrix3d &rotate,
+                                   double width_mm,
+                                   StitchImage *input);
 
   virtual void make_lens_command(StitchCommand *parent);
 };

+ 32 - 32
pandaapp/src/stitchbase/stitchParser.h

@@ -1,35 +1,35 @@
-#define	NUMBER	257
-#define	IDENTIFIER	258
-#define	STRING	259
-#define	KW_DEFINE	260
-#define	KW_LENS	261
-#define	KW_INPUT_IMAGE	262
-#define	KW_OUTPUT_IMAGE	263
-#define	KW_PERSPECTIVE	264
-#define	KW_FISHEYE	265
-#define	KW_CYLINDRICAL	266
-#define	KW_PSPHERE	267
-#define	KW_FOCAL_LENGTH	268
-#define	KW_FOV	269
-#define	KW_SINGULARITY_TOLERANCE	270
-#define	KW_RESOLUTION	271
-#define	KW_FILENAME	272
-#define	KW_POINT	273
-#define	KW_SHOW_POINTS	274
-#define	KW_IMAGE_SIZE	275
-#define	KW_FILM_SIZE	276
-#define	KW_FILM_OFFSET	277
-#define	KW_GRID	278
-#define	KW_UNTEXTURED_COLOR	279
-#define	KW_HPR	280
-#define	KW_LAYERS	281
-#define	KW_STITCH	282
-#define	KW_POINTS	283
-#define	KW_USING	284
-#define	KW_IN	285
-#define	KW_MM	286
-#define	KW_CM	287
-#define	KW_P	288
+#define NUMBER  257
+#define IDENTIFIER      258
+#define STRING  259
+#define KW_DEFINE       260
+#define KW_LENS 261
+#define KW_INPUT_IMAGE  262
+#define KW_OUTPUT_IMAGE 263
+#define KW_PERSPECTIVE  264
+#define KW_FISHEYE      265
+#define KW_CYLINDRICAL  266
+#define KW_PSPHERE      267
+#define KW_FOCAL_LENGTH 268
+#define KW_FOV  269
+#define KW_SINGULARITY_TOLERANCE        270
+#define KW_RESOLUTION   271
+#define KW_FILENAME     272
+#define KW_POINT        273
+#define KW_SHOW_POINTS  274
+#define KW_IMAGE_SIZE   275
+#define KW_FILM_SIZE    276
+#define KW_FILM_OFFSET  277
+#define KW_GRID 278
+#define KW_UNTEXTURED_COLOR     279
+#define KW_HPR  280
+#define KW_LAYERS       281
+#define KW_STITCH       282
+#define KW_POINTS       283
+#define KW_USING        284
+#define KW_IN   285
+#define KW_MM   286
+#define KW_CM   287
+#define KW_P    288
 
 
 extern YYSTYPE stitchyylval;

+ 82 - 82
pandaapp/src/stitchbase/stitchParser.yxx

@@ -21,7 +21,7 @@ static StitchCommand *parent;
 
 void
 stitch_init_parser(istream &in, const string &filename,
-		   StitchCommand *tos) {
+                   StitchCommand *tos) {
   stitch_init_lexer(in, filename);
   parent = tos;
   cstack.push_back(parent);
@@ -81,119 +81,119 @@ stitch_init_parser(istream &in, const string &filename,
 %%
 
 stitch_file:
-	commands
+        commands
 
 commands:
-	empty
-	| commands command
+        empty
+        | commands command
 {
   //  parent->add_nested($2);
 }
-	| commands KW_POINTS '{' points_list '}'
-	;
+        | commands KW_POINTS '{' points_list '}'
+        ;
 
 command:
-	group_command
+        group_command
 {
   parent = $1;
   cstack.push_back(parent);
 }
-	nested_commands
+        nested_commands
 {
   cstack.pop_back();
   parent = cstack.back();
 }
-	| simple_command ';'
+        | simple_command ';'
 {
   $$ = $1;
 }
-	;
+        ;
 
 nested_commands:
-	'{' commands '}'
-	| ';'
-	;
+        '{' commands '}'
+        | ';'
+        ;
 
 group_command:
-	KW_DEFINE name
+        KW_DEFINE name
 {
   $$ = new StitchCommand(parent, StitchCommand::C_define);
   $$->set_name($2);
 }
-	| KW_LENS optional_name
+        | KW_LENS optional_name
 {
   $$ = new StitchCommand(parent, StitchCommand::C_lens);
   $$->set_name($2);
 }
-	| KW_INPUT_IMAGE optional_name
+        | KW_INPUT_IMAGE optional_name
 {
   $$ = new StitchCommand(parent, StitchCommand::C_input_image);
   $$->set_name($2);
 }
-	| KW_OUTPUT_IMAGE optional_name
+        | KW_OUTPUT_IMAGE optional_name
 {
   $$ = new StitchCommand(parent, StitchCommand::C_output_image);
   $$->set_name($2);
 }
-	| KW_STITCH optional_name
+        | KW_STITCH optional_name
 {
   $$ = new StitchCommand(parent, StitchCommand::C_stitch);
   $$->set_name($2);
 }
-	| KW_USING
+        | KW_USING
 {
   cstack.push_back(new StitchCommand(parent, StitchCommand::C_using));
 }
-	using_list
+        using_list
 {
   $$ = cstack.back();
   cstack.pop_back();
 }
-	;
+        ;
 
 simple_command:
-	KW_PERSPECTIVE
+        KW_PERSPECTIVE
 {
   $$ = new StitchCommand(parent, StitchCommand::C_perspective);
 }
-	| KW_FISHEYE
+        | KW_FISHEYE
 {
   $$ = new StitchCommand(parent, StitchCommand::C_fisheye);
 }
-	| KW_CYLINDRICAL
+        | KW_CYLINDRICAL
 {
   $$ = new StitchCommand(parent, StitchCommand::C_cylindrical);
 }
-	| KW_PSPHERE
+        | KW_PSPHERE
 {
   $$ = new StitchCommand(parent, StitchCommand::C_psphere);
 }
-	| KW_FOCAL_LENGTH length
+        | KW_FOCAL_LENGTH length
 {
   $$ = new StitchCommand(parent, StitchCommand::C_focal_length);
   $$->set_length($2);
 }
-	| KW_FOV NUMBER
+        | KW_FOV NUMBER
 {
   $$ = new StitchCommand(parent, StitchCommand::C_fov);
   $$->set_number($2);
 }
-	| KW_SINGULARITY_TOLERANCE NUMBER
+        | KW_SINGULARITY_TOLERANCE NUMBER
 {
   $$ = new StitchCommand(parent, StitchCommand::C_singularity_tolerance);
   $$->set_number($2);
 }
-	| KW_RESOLUTION resolution
+        | KW_RESOLUTION resolution
 {
   $$ = new StitchCommand(parent, StitchCommand::C_resolution);
   $$->set_resolution($2);
 }
-	| KW_FILENAME STRING
+        | KW_FILENAME STRING
 {
   $$ = new StitchCommand(parent, StitchCommand::C_filename);
   $$->set_str($2);
 }
-	| KW_POINT name point
+        | KW_POINT name point
 {
   if ($<num_components>3 == 2) {
     $$ = new StitchCommand(parent, StitchCommand::C_point2d);
@@ -204,73 +204,73 @@ simple_command:
   }
   $$->set_name($2);
 }
-	| KW_SHOW_POINTS NUMBER color
+        | KW_SHOW_POINTS NUMBER color
 {
   $$ = new StitchCommand(parent, StitchCommand::C_show_points);
   $$->set_number($2);
   $$->set_color($3);
 }
-	| KW_IMAGE_SIZE vec2
+        | KW_IMAGE_SIZE vec2
 {
   $$ = new StitchCommand(parent, StitchCommand::C_image_size);
   $$->set_point2d((const LPoint2d &)$2);
 }
-	| KW_FILM_SIZE length_pair
+        | KW_FILM_SIZE length_pair
 {
   $$ = new StitchCommand(parent, StitchCommand::C_film_size);
   $$->set_length_pair((const LPoint2d &)$2);
 }
-	| KW_FILM_OFFSET length_pair
+        | KW_FILM_OFFSET length_pair
 {
   $$ = new StitchCommand(parent, StitchCommand::C_film_offset);
   $$->set_length_pair((const LPoint2d &)$2);
 }
-	| KW_GRID vec2
+        | KW_GRID vec2
 {
   $$ = new StitchCommand(parent, StitchCommand::C_grid);
   $$->set_point2d((const LPoint2d &)$2);
 }
-	| KW_UNTEXTURED_COLOR color
+        | KW_UNTEXTURED_COLOR color
 {
   $$ = new StitchCommand(parent, StitchCommand::C_untextured_color);
   $$->set_color((const Colord &)$2);
 }
-	| KW_HPR vec3
+        | KW_HPR vec3
 {
   $$ = new StitchCommand(parent, StitchCommand::C_hpr);
   $$->set_point3d((const LPoint3d &)$2);
 }
-	| KW_LAYERS
+        | KW_LAYERS
 {
   $$ = new StitchCommand(parent, StitchCommand::C_layers);
 }
-	| IDENTIFIER
+        | IDENTIFIER
 {
   $$ = new StitchCommand(parent, StitchCommand::C_user_command);
   if (!$$->add_using($1)) {
     yyerror("Undefined identifier " + $1);
   }
 }
-	;
+        ;
 
 using_list:
-	IDENTIFIER
+        IDENTIFIER
 {
   if (!cstack.back()->add_using($1)) {
     yyerror("Undefined identifier " + $1);
   }
 }
-	| using_list ',' IDENTIFIER	
+        | using_list ',' IDENTIFIER
 {
   if (!cstack.back()->add_using($3)) {
     yyerror("Undefined identifier " + $3);
   }
 }
-	;
+        ;
 
 points_list:
-	empty
-	| points_list name point ';'
+        empty
+        | points_list name point ';'
 {
   StitchCommand *cmd;
   if ($<num_components>3 == 2) {
@@ -283,141 +283,141 @@ points_list:
   cmd->set_name($2);
   //  parent->add_nested(cmd);
 }
-	;
+        ;
   
 
 length:
-	NUMBER length_units
+        NUMBER length_units
 {
   $$ = $1 * $2;   // convert to mm
 }
-	;
+        ;
 
 length_units:
-	KW_IN
+        KW_IN
 {
   $$ = 25.4;   // in to mm
 }
-	| KW_CM
+        | KW_CM
 {
   $$ = 10.0;   // cm to mm
 }
-	| KW_MM
+        | KW_MM
 {
   $$ = 1.0;
 }
-	;
+        ;
 
 
 resolution:
-	NUMBER resolution_units
+        NUMBER resolution_units
 {
   $$ = $1 * $2;    // convert to pixels per mm
 }
-	;
+        ;
 
 resolution_units:
-	KW_P '/' length_units
+        KW_P '/' length_units
 {
   $$ = 1.0 / $3;
 }
-	;
+        ;
 
 point:
-	'(' NUMBER NUMBER ')'
+        '(' NUMBER NUMBER ')'
 {
   $$.set($2, $3, 0.0, 0.0);
   $<num_components>$ = 2;
 }
-	| '(' NUMBER ',' NUMBER ')'
+        | '(' NUMBER ',' NUMBER ')'
 {
   $$.set($2, $4, 0.0, 0.0);
   $<num_components>$ = 2;
 }
-	| '(' NUMBER NUMBER NUMBER ')'
+        | '(' NUMBER NUMBER NUMBER ')'
 {
   $$.set($2, $3, $4, 0.0);
   $<num_components>$ = 3;
 }
-	| '(' NUMBER ',' NUMBER ',' NUMBER ')'
+        | '(' NUMBER ',' NUMBER ',' NUMBER ')'
 {
   $$.set($2, $4, $6, 0.0);
   $<num_components>$ = 3;
 }
-	;
+        ;
 
 vec2:
-	'(' NUMBER NUMBER ')'
+        '(' NUMBER NUMBER ')'
 {
   $$.set($2, $3, 0.0, 0.0);
   $<num_components>$ = 2;
 }
-	| '(' NUMBER ',' NUMBER ')'
+        | '(' NUMBER ',' NUMBER ')'
 {
   $$.set($2, $4, 0.0, 0.0);
   $<num_components>$ = 2;
 }
-	;
+        ;
 
-vec3:	'(' NUMBER NUMBER NUMBER ')'
+vec3:   '(' NUMBER NUMBER NUMBER ')'
 {
   $$.set($2, $3, $4, 0.0);
   $<num_components>$ = 3;
 }
-	| '(' NUMBER ',' NUMBER ',' NUMBER ')'
+        | '(' NUMBER ',' NUMBER ',' NUMBER ')'
 {
   $$.set($2, $4, $6, 0.0);
   $<num_components>$ = 3;
 }
-	;
+        ;
 
 length_pair:
-	'(' length length ')'
+        '(' length length ')'
 {
   $$.set($2, $3, 0.0, 0.0);
   $<num_components>$ = 2;
 }
-	| '(' length ',' length ')'
+        | '(' length ',' length ')'
 {
   $$.set($2, $4, 0.0, 0.0);
   $<num_components>$ = 2;
 }
-	;
+        ;
 
 color:
-	'(' NUMBER NUMBER NUMBER ')'
+        '(' NUMBER NUMBER NUMBER ')'
 {
   $$.set($2, $3, $4, 1.0);
   $<num_components>$ = 3;
 }
-	| '(' NUMBER ',' NUMBER ',' NUMBER ')'
+        | '(' NUMBER ',' NUMBER ',' NUMBER ')'
 {
   $$.set($2, $4, $6, 1.0);
   $<num_components>$ = 3;
 }
-	| '(' NUMBER NUMBER NUMBER NUMBER ')'
+        | '(' NUMBER NUMBER NUMBER NUMBER ')'
 {
   $$.set($2, $3, $4, $5);
   $<num_components>$ = 4;
 }
-	| '(' NUMBER ',' NUMBER ',' NUMBER ',' NUMBER ')'
+        | '(' NUMBER ',' NUMBER ',' NUMBER ',' NUMBER ')'
 {
   $$.set($2, $4, $6, $8);
   $<num_components>$ = 4;
 }
-	;
+        ;
 
 name:
-	IDENTIFIER
-	;
+        IDENTIFIER
+        ;
 
 optional_name:
-	IDENTIFIER
-	| empty
+        IDENTIFIER
+        | empty
 {
   $$ = "";
 }
-	;
+        ;
 
 empty:
-	;
+        ;

+ 1 - 1
pandaapp/src/stitchbase/stitchParserDefs.h

@@ -15,7 +15,7 @@ class StitchCommand;
 int stitchyyparse();
 
 void stitch_init_parser(istream &in, const string &filename,
-			StitchCommand *tos);
+                        StitchCommand *tos);
 
 // This structure holds the return value for each token.
 // Traditionally, this is a union, and is declared with the %union

+ 1 - 1
pandaapp/src/stitchbase/stitchPerspectiveLens.cxx

@@ -59,7 +59,7 @@ project(const LVector3d &vec, double width_mm) const {
     return LPoint2d(r / 0.000001, u / 0.000001);
   } else {
     return LPoint2d(r / f * get_focal_length(width_mm), 
-		    u / f * get_focal_length(width_mm));
+                    u / f * get_focal_length(width_mm));
   }
 }
 

+ 56 - 56
pandaapp/src/stitchbase/stitcher.cxx

@@ -128,8 +128,8 @@ stitch() {
     for (ii = _images.begin(); ii != _images.end(); ++ii) {
       int score = score_image(*ii);
       if (score > max_score) {
-	max_score = score;
-	best_image = ii;
+        max_score = score;
+        best_image = ii;
       }
     }
     if (best_image == _images.end()) {
@@ -161,7 +161,7 @@ stitch() {
 
   if (!_images.empty()) {
     nout << "Not enough shared points; " << _images.size()
-	 << " images remain unstitched.\n";
+         << " images remain unstitched.\n";
   }
 
   nout << "Net score is " << net_stitch_score << "\n";
@@ -259,17 +259,17 @@ stitch_image(StitchImage *image) {
       best_j = 0;
     } else {
       for (int i = 0; i < (int)mp.size(); i++) {
-	for (int j = 0; j < (int)mp.size(); j++) {
-	  if (j != i) {
-	    LMatrix3d rot;
-	    double score = try_match(image, rot, mp, i, j);
-	    if (score < best_score || best_i == -1) {
-	      best_i = i;
-	      best_j = j;
-	      best_score = score;
-	    }
-	  }
-	}
+        for (int j = 0; j < (int)mp.size(); j++) {
+          if (j != i) {
+            LMatrix3d rot;
+            double score = try_match(image, rot, mp, i, j);
+            if (score < best_score || best_i == -1) {
+              best_i = i;
+              best_j = j;
+              best_score = score;
+            }
+          }
+        }
       }
     }
 
@@ -301,29 +301,29 @@ stitch_image(StitchImage *image) {
     int x, y;
     for (y = 0; y < y_verts; y++) {
       for (x = 0; x < x_verts; x++) {
-	LPoint2d p = image->get_grid_uv(x, y);
-	LVector2d offset(0.0, 0.0);
-	double net = 0.0;
-	
-	MatchingPoints::const_iterator cmi;
-	bool done = false;
-	for (cmi = mp.begin(); cmi != mp.end() && !done; ++cmi) {
-	  LVector2d v = p - (*cmi)._got_uv;
-	  double d = pow(dot(v, v), 0.1);
-	  if (d < 0.0001) {
-	    // This one is dead on; stop here and never mind.
-	    offset = (*cmi)._diff;
-	    net = 1.0;
-	    done = true;
-	  } else {
-	    double scale = 1.0 / d;
-	    offset += (*cmi)._diff * scale;
-	    net += scale;
-	  }
-	}
-	
-	offset /= net;
-	image->_morph._table[y][x]._p[MorphGrid::TT_out] += offset;
+        LPoint2d p = image->get_grid_uv(x, y);
+        LVector2d offset(0.0, 0.0);
+        double net = 0.0;
+
+        MatchingPoints::const_iterator cmi;
+        bool done = false;
+        for (cmi = mp.begin(); cmi != mp.end() && !done; ++cmi) {
+          LVector2d v = p - (*cmi)._got_uv;
+          double d = pow(dot(v, v), 0.1);
+          if (d < 0.0001) {
+            // This one is dead on; stop here and never mind.
+            offset = (*cmi)._diff;
+            net = 1.0;
+            done = true;
+          } else {
+            double scale = 1.0 / d;
+            offset += (*cmi)._diff * scale;
+            net += scale;
+          }
+        }
+
+        offset /= net;
+        image->_morph._table[y][x]._p[MorphGrid::TT_out] += offset;
       }
     }
     image->_morph.recompute();
@@ -335,7 +335,7 @@ stitch_image(StitchImage *image) {
     LVector3d va = normalize(LVector3d(image->extrude((*mi)._got_uv)));
     LVector3d vb = (*mi)._p->_space;
     nout << 1000.0 * (1.0 - dot(va, vb)) << " for " << (*mi)._p->_name 
-	 << "\n   at " << va << " vs. " << vb << "\n";
+         << "\n   at " << va << " vs. " << vb << "\n";
   }
   nout << "\n";
 
@@ -345,9 +345,9 @@ stitch_image(StitchImage *image) {
     (*mi)._diff = (*mi)._need_uv - (*mi)._got_uv;
     
     nout << (*mi)._p->_name
-	 << " "<< (*mi)._need_uv << " vs. " << (*mi)._got_uv
-	 << " diff is " << length((*mi)._diff * image->_uv_to_pixels)
-	 << " pixels\n";
+         << " "<< (*mi)._need_uv << " vs. " << (*mi)._got_uv
+         << " diff is " << length((*mi)._diff * image->_uv_to_pixels)
+         << " pixels\n";
   }
   */
 
@@ -363,8 +363,8 @@ stitch_image(StitchImage *image) {
       StitchPoint *sp = (*ppi).second;
       
       if (!sp->_space_known) {
-	LVector3d space = normalize(image->extrude(uv));
-	sp->set_space(space);
+        LVector3d space = normalize(image->extrude(uv));
+        sp->set_space(space);
       }
     }
   }
@@ -391,18 +391,18 @@ feather_image(StitchImage *image) {
       LVector3d space = image->get_grid_vector(x, y);
       Images::const_iterator ii;
       for (ii = _placed.begin(); 
-	   ii != _placed.end() && 
-	     !image->_morph._table[y][x]._over_another; 
-	   ++ii) {
-	StitchImage *other = (*ii);
-	if (other->_index < image->_index) {
-	  LPoint2d uv = other->project(space);
-	  if (uv[0] >= 0.0 && uv[0] <= 1.0 &&
-	      uv[1] >= 0.0 && uv[1] <= 1.0) {
-	    // This point is over the other image.
-	    image->_morph._table[y][x]._over_another = true;
-	  }
-	}
+           ii != _placed.end() && 
+             !image->_morph._table[y][x]._over_another; 
+           ++ii) {
+        StitchImage *other = (*ii);
+        if (other->_index < image->_index) {
+          LPoint2d uv = other->project(space);
+          if (uv[0] >= 0.0 && uv[0] <= 1.0 &&
+              uv[1] >= 0.0 && uv[1] <= 1.0) {
+            // This point is over the other image.
+            image->_morph._table[y][x]._over_another = true;
+          }
+        }
       }
     }
   }
@@ -413,7 +413,7 @@ feather_image(StitchImage *image) {
 
 double Stitcher::
 try_match(StitchImage *image, LMatrix3d &rot,
-	  const Stitcher::MatchingPoints &mp, int zero, int one) {
+          const Stitcher::MatchingPoints &mp, int zero, int one) {
 
   // Now rotate this image relative to the other so the first pair of
   // points exactly coincide.

+ 1 - 1
pandaapp/src/stitchbase/stitcher.h

@@ -50,7 +50,7 @@ private:
   void feather_image(StitchImage *image);
 
   double try_match(StitchImage *image, LMatrix3d &rot,
-		   const MatchingPoints &mp, int zero, int one);
+                   const MatchingPoints &mp, int zero, int one);
 
   Images _images;
 

+ 3 - 3
pandaapp/src/stitchbase/triangle.cxx

@@ -12,7 +12,7 @@ is_right(const LVector2d &v1, const LVector2d &v2) {
 
 bool
 triangle_contains_point(const LPoint2d &p, const LPoint2d &v0,
-			const LPoint2d &v1, const LPoint2d &v2) {
+                        const LPoint2d &v1, const LPoint2d &v2) {
   // In the case of a triangle defined with points in counterclockwise
   // order, a point is interior to the triangle iff the point is not
   // right of each of the edges.
@@ -32,8 +32,8 @@ triangle_contains_point(const LPoint2d &p, const LPoint2d &v0,
 
 bool
 triangle_contains_circle(const LPoint2d &p, double radius,
-			 const LPoint2d &v0,
-			 const LPoint2d &v1, const LPoint2d &v2) {
+                         const LPoint2d &v0,
+                         const LPoint2d &v1, const LPoint2d &v2) {
   // This is a cheesy hack.  Instead of performing an actual
   // triangle-circle intersection test, we simply move the point
   // radius units closer to the centroid of the triangle, and test

+ 3 - 3
pandaapp/src/stitchbase/triangle.h

@@ -14,11 +14,11 @@
 // order.
 bool
 triangle_contains_point(const LPoint2d &p, const LPoint2d &v0,
-			const LPoint2d &v1, const LPoint2d &v2);
+                        const LPoint2d &v1, const LPoint2d &v2);
 
 bool
 triangle_contains_circle(const LPoint2d &p, double radius,
-			 const LPoint2d &v0,
-			 const LPoint2d &v1, const LPoint2d &v2);
+                         const LPoint2d &v0,
+                         const LPoint2d &v1, const LPoint2d &v2);
 
 #endif

+ 189 - 189
pandaapp/src/stitchbase/triangleRasterizer.cxx

@@ -9,10 +9,10 @@
 // Inline function declared up here for the forward reference.
 inline void TriangleRasterizer::
 filter_pixel(RGBColord &rgb, double &alpha,
-	     double s, double t,
-	     double dsdx, double dtdx, double dsdy, double dtdy) {
+             double s, double t,
+             double dsdx, double dtdx, double dsdy, double dtdy) {
   filter_pixel(rgb, alpha, s, t, 
-	       max(max(dsdx, dtdx), max(dsdy, dtdy)) / 2.0);
+               max(max(dsdx, dtdx), max(dsdy, dtdy)) / 2.0);
 }
 
 
@@ -36,8 +36,8 @@ TriangleRasterizer() {
 
 void TriangleRasterizer::
 draw_triangle(const RasterizerVertex *v0, 
-	      const RasterizerVertex *v1, 
-	      const RasterizerVertex *v2) {
+              const RasterizerVertex *v1, 
+              const RasterizerVertex *v2) {
   if ((v0->_visibility & v1->_visibility & v2->_visibility) != 0) {
     // All three vertices are out of bounds in the same direction, so
     // the triangle is completely out of bounds.  Don't bother trying
@@ -62,19 +62,19 @@ draw_triangle(const RasterizerVertex *v0,
 
     if (y0<=y1) {
       if (y1<=y2) {
-	vMin = v0;   vMid = v1;   vMax = v2;   /* y0<=y1<=y2 */
+        vMin = v0;   vMid = v1;   vMax = v2;   /* y0<=y1<=y2 */
       } else if (y2<=y0) {
-	vMin = v2;   vMid = v0;   vMax = v1;   /* y2<=y0<=y1 */
+        vMin = v2;   vMid = v0;   vMax = v1;   /* y2<=y0<=y1 */
       } else {
-	vMin = v0;   vMid = v2;   vMax = v1;   /* y0<=y2<=y1 */
+        vMin = v0;   vMid = v2;   vMax = v1;   /* y0<=y2<=y1 */
       }
     } else {
       if (y0<=y2) {
-	vMin = v1;   vMid = v0;   vMax = v2;   /* y1<=y0<=y2 */
+        vMin = v1;   vMid = v0;   vMax = v2;   /* y1<=y0<=y2 */
       } else if (y2<=y1) {
-	vMin = v2;   vMid = v1;   vMax = v0;   /* y2<=y1<=y0 */
+        vMin = v2;   vMid = v1;   vMax = v0;   /* y2<=y1<=y0 */
       } else {
-	vMin = v1;   vMid = v2;   vMax = v0;   /* y1<=y2<=y0 */
+        vMin = v1;   vMid = v2;   vMax = v0;   /* y1<=y2<=y0 */
       }
     }
   }
@@ -177,7 +177,7 @@ draw_triangle(const RasterizerVertex *v0,
     */
 
   {
-    int ltor;		/* true if scanning left-to-right */
+    int ltor;           /* true if scanning left-to-right */
 
     // For interpolating the alpha value.
     double dadx, dady;
@@ -298,173 +298,173 @@ draw_triangle(const RasterizerVertex *v0,
       FixedPoint ft, fdtOuter, fdtInner;
 
       for (subTriangle=0; subTriangle<=1; subTriangle++) {
-	Edge *eLeft, *eRight;
-	int setupLeft, setupRight;
-	int lines;
-
-	if (subTriangle==0) {
-	  /* bottom half */
-	  if (ltor) {
-	    eLeft = &eMaj;
-	    eRight = &eBot;
-	    lines = eRight->_lines;
-	    setupLeft = 1;
-	    setupRight = 1;
-	  }
-	  else {
-	    eLeft = &eBot;
-	    eRight = &eMaj;
-	    lines = eLeft->_lines;
-	    setupLeft = 1;
-	    setupRight = 1;
-	  }
-	}
-	else {
-	  /* top half */
-	  if (ltor) {
-	    eLeft = &eMaj;
-	    eRight = &eTop;
-	    lines = eRight->_lines;
-	    setupLeft = 0;
-	    setupRight = 1;
-	  }
-	  else {
-	    eLeft = &eTop;
-	    eRight = &eMaj;
-	    lines = eLeft->_lines;
-	    setupLeft = 1;
-	    setupRight = 0;
-	  }
-	  if (lines==0) return;
-	}
-
-	if (setupLeft && eLeft->_lines>0) {
-	  const RasterizerVertex *vLower;
-	  FixedPoint fsx = eLeft->_fsx;
-	  fx = FixedCeil(fsx);
-	  fError = fx - fsx - FIXED_ONE;
-	  fxLeftEdge = fsx - FIXED_EPSILON;
-	  fdxLeftEdge = eLeft->_fdxdy;
-	  fdxOuter = FixedFloor(fdxLeftEdge - FIXED_EPSILON);
-	  fdError = fdxOuter - fdxLeftEdge + FIXED_ONE;
-	  idxOuter = FixedToInt(fdxOuter);
-	  dxOuter = (double) idxOuter;
-
-	  fy = eLeft->_fsy;
-	  iy = FixedToInt(fy);
-
-	  adjx = (double)(fx - eLeft->_fx0);  /* SCALED! */
-	  adjy = eLeft->_adjy;		 /* SCALED! */
-	  
-	  vLower = eLeft->_v0;
-	  
-	  /*
-	   * Now we need the set of parameter (z, color, etc.) values at
-	   * the point (fx, fy).  This gives us properly-sampled parameter
-	   * values that we can step from pixel to pixel.  Furthermore,
-	   * although we might have intermediate results that overflow
-	   * the normal parameter range when we step temporarily outside
-	   * the triangle, we shouldn't overflow or underflow for any
-	   * pixel that's actually inside the triangle.
-	   */
-	  
-	  // Interpolate alpha
-	  fa = (FixedPoint)(vLower->_alpha * FIXED_SCALE + dadx * adjx + dady * adjy)
-	    + FIXED_HALF;
-	  fdaOuter = SignedFloatToFixed(dady + dxOuter * dadx);
-	  // Interpolate texture coordinates
-	  {
-	    double s0, t0;
-	    s0 = vLower->_uv[0] * twidth;
-	    fs = (FixedPoint)(s0 * FIXED_SCALE + dsdx * adjx + dsdy * adjy) + FIXED_HALF;
-	    fdsOuter = SignedFloatToFixed(dsdy + dxOuter * dsdx);
-	    t0 = vLower->_uv[1] * theight;
-	    ft = (FixedPoint)(t0 * FIXED_SCALE + dtdx * adjx + dtdy * adjy) + FIXED_HALF;
-	    fdtOuter = SignedFloatToFixed(dtdy + dxOuter * dtdx);
-	  }
-	  
-	} /*if setupLeft*/
-	
-	
-	if (setupRight && eRight->_lines>0) {
-	  fxRightEdge = eRight->_fsx - FIXED_EPSILON;
-	  fdxRightEdge = eRight->_fdxdy;
-	}
-	
-	if (lines==0) {
-	  continue;
-	}
-
-	/* Rasterize setup */
-	fdaInner = fdaOuter + fdadx;
-	fdsInner = fdsOuter + fdsdx;
-	fdtInner = fdtOuter + fdtdx;
-	
-	while (lines>0) {
-	  if (iy >= 0 && iy < _output->get_y_size()) {
-	    /* initialize the span interpolants to the leftmost value */
-	    /* ff = fixed-pt fragment */
-	    FixedPoint ffa = fa;
-	    FixedPoint ffs = fs,  fft = ft;
-
-	    int left = FixedToInt(fxLeftEdge);
-	    int right = FixedToInt(fxRightEdge);
-
-	    // Alpha
-	    {
-	      //	      FixedPoint ffaend = ffa+(right-left-1)*fdadx;
-	      //	      if (ffaend<0) ffa -= ffaend;
-	      //	      if (ffa<0) ffa = 0;
-	    }
-
-	    // Rasterize left to right at row iy.
-	    if (right > left) {
-	      ffs -= FIXED_HALF; /* off-by-one error? */        
-	      fft -= FIXED_HALF;
-	      ffa -= FIXED_HALF;
-	      for (int ix = left; ix < right; ix++) {
-		if (ix >= 0 && ix < _output->get_x_size()) {
-		  RGBColord rgb;
-		  double alpha;
-		  filter_pixel(rgb, alpha,
-			       FixedToFloat(ffs), FixedToFloat(fft),
-			       dsdx, dtdx, dsdy, dtdy);
-		  alpha *= FixedToFloat(ffa);
-		  _output->blend(ix, iy, rgb, alpha);
-		}
-
-		ffs += fdsdx;
-		fft += fdtdx;
-		ffa += fdadx;
-	      }
-	    }
-	  }
-
-	  /*
-	   * Advance to the next scan line.  Compute the
-	   * new edge coordinates, and adjust the
-	   * pixel-center x coordinate so that it stays
-	   * on or inside the major edge.
-	   */
-	  iy++;
-	  lines--;
-
-	  fxLeftEdge += fdxLeftEdge;
-	  fxRightEdge += fdxRightEdge;
-
-	  fError += fdError;
-	  if (fError >= 0) {
-	    fError -= FIXED_ONE;
-
-	    fa += fdaOuter;
-	    fs += fdsOuter;
-	    ft += fdtOuter;
-	  } else {
-	    fa += fdaInner;
-	    fs += fdsInner;
-	    ft += fdtInner;
-	  }
-	} /*while lines>0*/
+        Edge *eLeft, *eRight;
+        int setupLeft, setupRight;
+        int lines;
+
+        if (subTriangle==0) {
+          /* bottom half */
+          if (ltor) {
+            eLeft = &eMaj;
+            eRight = &eBot;
+            lines = eRight->_lines;
+            setupLeft = 1;
+            setupRight = 1;
+          }
+          else {
+            eLeft = &eBot;
+            eRight = &eMaj;
+            lines = eLeft->_lines;
+            setupLeft = 1;
+            setupRight = 1;
+          }
+        }
+        else {
+          /* top half */
+          if (ltor) {
+            eLeft = &eMaj;
+            eRight = &eTop;
+            lines = eRight->_lines;
+            setupLeft = 0;
+            setupRight = 1;
+          }
+          else {
+            eLeft = &eTop;
+            eRight = &eMaj;
+            lines = eLeft->_lines;
+            setupLeft = 1;
+            setupRight = 0;
+          }
+          if (lines==0) return;
+        }
+
+        if (setupLeft && eLeft->_lines>0) {
+          const RasterizerVertex *vLower;
+          FixedPoint fsx = eLeft->_fsx;
+          fx = FixedCeil(fsx);
+          fError = fx - fsx - FIXED_ONE;
+          fxLeftEdge = fsx - FIXED_EPSILON;
+          fdxLeftEdge = eLeft->_fdxdy;
+          fdxOuter = FixedFloor(fdxLeftEdge - FIXED_EPSILON);
+          fdError = fdxOuter - fdxLeftEdge + FIXED_ONE;
+          idxOuter = FixedToInt(fdxOuter);
+          dxOuter = (double) idxOuter;
+
+          fy = eLeft->_fsy;
+          iy = FixedToInt(fy);
+
+          adjx = (double)(fx - eLeft->_fx0);  /* SCALED! */
+          adjy = eLeft->_adjy;           /* SCALED! */
+
+          vLower = eLeft->_v0;
+
+          /*
+           * Now we need the set of parameter (z, color, etc.) values at
+           * the point (fx, fy).  This gives us properly-sampled parameter
+           * values that we can step from pixel to pixel.  Furthermore,
+           * although we might have intermediate results that overflow
+           * the normal parameter range when we step temporarily outside
+           * the triangle, we shouldn't overflow or underflow for any
+           * pixel that's actually inside the triangle.
+           */
+
+          // Interpolate alpha
+          fa = (FixedPoint)(vLower->_alpha * FIXED_SCALE + dadx * adjx + dady * adjy)
+            + FIXED_HALF;
+          fdaOuter = SignedFloatToFixed(dady + dxOuter * dadx);
+          // Interpolate texture coordinates
+          {
+            double s0, t0;
+            s0 = vLower->_uv[0] * twidth;
+            fs = (FixedPoint)(s0 * FIXED_SCALE + dsdx * adjx + dsdy * adjy) + FIXED_HALF;
+            fdsOuter = SignedFloatToFixed(dsdy + dxOuter * dsdx);
+            t0 = vLower->_uv[1] * theight;
+            ft = (FixedPoint)(t0 * FIXED_SCALE + dtdx * adjx + dtdy * adjy) + FIXED_HALF;
+            fdtOuter = SignedFloatToFixed(dtdy + dxOuter * dtdx);
+          }
+
+        } /*if setupLeft*/
+
+
+        if (setupRight && eRight->_lines>0) {
+          fxRightEdge = eRight->_fsx - FIXED_EPSILON;
+          fdxRightEdge = eRight->_fdxdy;
+        }
+
+        if (lines==0) {
+          continue;
+        }
+
+        /* Rasterize setup */
+        fdaInner = fdaOuter + fdadx;
+        fdsInner = fdsOuter + fdsdx;
+        fdtInner = fdtOuter + fdtdx;
+
+        while (lines>0) {
+          if (iy >= 0 && iy < _output->get_y_size()) {
+            /* initialize the span interpolants to the leftmost value */
+            /* ff = fixed-pt fragment */
+            FixedPoint ffa = fa;
+            FixedPoint ffs = fs,  fft = ft;
+
+            int left = FixedToInt(fxLeftEdge);
+            int right = FixedToInt(fxRightEdge);
+
+            // Alpha
+            {
+              //              FixedPoint ffaend = ffa+(right-left-1)*fdadx;
+              //              if (ffaend<0) ffa -= ffaend;
+              //              if (ffa<0) ffa = 0;
+            }
+
+            // Rasterize left to right at row iy.
+            if (right > left) {
+              ffs -= FIXED_HALF; /* off-by-one error? */        
+              fft -= FIXED_HALF;
+              ffa -= FIXED_HALF;
+              for (int ix = left; ix < right; ix++) {
+                if (ix >= 0 && ix < _output->get_x_size()) {
+                  RGBColord rgb;
+                  double alpha;
+                  filter_pixel(rgb, alpha,
+                               FixedToFloat(ffs), FixedToFloat(fft),
+                               dsdx, dtdx, dsdy, dtdy);
+                  alpha *= FixedToFloat(ffa);
+                  _output->blend(ix, iy, rgb, alpha);
+                }
+
+                ffs += fdsdx;
+                fft += fdtdx;
+                ffa += fdadx;
+              }
+            }
+          }
+
+          /*
+           * Advance to the next scan line.  Compute the
+           * new edge coordinates, and adjust the
+           * pixel-center x coordinate so that it stays
+           * on or inside the major edge.
+           */
+          iy++;
+          lines--;
+
+          fxLeftEdge += fdxLeftEdge;
+          fxRightEdge += fdxRightEdge;
+
+          fError += fdError;
+          if (fError >= 0) {
+            fError -= FIXED_ONE;
+
+            fa += fdaOuter;
+            fs += fdsOuter;
+            ft += fdtOuter;
+          } else {
+            fa += fdaInner;
+            fs += fdsInner;
+            ft += fdtInner;
+          }
+        } /*while lines>0*/
 
       } /* for subTriangle */
 
@@ -493,9 +493,9 @@ draw_pixel(const RasterizerVertex *v0, double radius) {
       filter_pixel(rgb, alpha, v0->_uv[0], v0->_uv[1], radius);
     } else {
       filter_pixel(rgb, alpha, 
-		   v0->_uv[0] * (_texture->get_x_size() - 1), 
-		   v0->_uv[1] * (_texture->get_y_size() - 1),
-		   radius * (_texture->get_x_size() - 1));
+                   v0->_uv[0] * (_texture->get_x_size() - 1), 
+                   v0->_uv[1] * (_texture->get_y_size() - 1),
+                   radius * (_texture->get_x_size() - 1));
     }
     alpha *= v0->_alpha;
     _output->blend(ix, iy, rgb, alpha);
@@ -504,11 +504,11 @@ draw_pixel(const RasterizerVertex *v0, double radius) {
 
 void TriangleRasterizer::
 filter_pixel(RGBColord &rgb, double &alpha,
-	     double s, double t, double radius) {
+             double s, double t, double radius) {
   if (_texture == NULL) {
     rgb.set(_untextured_color[0], 
-	    _untextured_color[1],
-	    _untextured_color[2]);
+            _untextured_color[1],
+            _untextured_color[2]);
     alpha = _untextured_color[3];
     return;
   }
@@ -522,7 +522,7 @@ filter_pixel(RGBColord &rgb, double &alpha,
   
   if (!_filter_output) {
     if (si >= 0 && si < _texture->get_x_size() &&
-	ti >= 0 && ti < _texture->get_y_size()) {
+        ti >= 0 && ti < _texture->get_y_size()) {
       rgb = _texture->get_xel(si, ti);
       alpha = 1.0;
     }
@@ -536,9 +536,9 @@ filter_pixel(RGBColord &rgb, double &alpha,
     for (int xr = -ri; xr <= ri; xr++) {
       int sii = si + xr;
       if (sii >= 0 && sii < _texture->get_x_size() &&
-	  tii >= 0 && tii < _texture->get_y_size()) {
-	rgb += _texture->get_xel(sii, tii);
-	num_visible++;
+          tii >= 0 && tii < _texture->get_y_size()) {
+        rgb += _texture->get_xel(sii, tii);
+        num_visible++;
       }
       num_total++;
     }

+ 11 - 11
pandaapp/src/stitchbase/triangleRasterizer.h

@@ -27,8 +27,8 @@ public:
   TriangleRasterizer();
 
   void draw_triangle(const RasterizerVertex *v0, 
-		     const RasterizerVertex *v1, 
-		     const RasterizerVertex *v2);
+                     const RasterizerVertex *v1, 
+                     const RasterizerVertex *v2);
   void draw_pixel(const RasterizerVertex *v0, double radius);
 
   PNMImage *_output;
@@ -45,21 +45,21 @@ private:
 
     const RasterizerVertex *_v0;  //  Y(v0) < Y(v1)
     const RasterizerVertex *_v1;
-    double _dx;	                  // X(v1) - X(v0)
-    double _dy;	                  // Y(v1) - Y(v0)
-    FixedPoint _fdxdy;	          // dx/dy in fixed-point
-    FixedPoint _fsx;	          // first sample point x coord
+    double _dx;                   // X(v1) - X(v0)
+    double _dy;                   // Y(v1) - Y(v0)
+    FixedPoint _fdxdy;            // dx/dy in fixed-point
+    FixedPoint _fsx;              // first sample point x coord
     FixedPoint _fsy;
-    double _adjy;	          // adjust from v[0]->fy to fsy, scaled
+    double _adjy;                 // adjust from v[0]->fy to fsy, scaled
     int _lines;                   // number of lines to be sampled on this edge
-    FixedPoint _fx0;	          // fixed pt X of lower endpoint
+    FixedPoint _fx0;              // fixed pt X of lower endpoint
   };
 
   inline void filter_pixel(RGBColord &rgb, double &alpha,
-			   double s, double t,
-			   double dsdx, double dtdx, double dsdy, double dtdy);
+                           double s, double t,
+                           double dsdx, double dtdx, double dsdy, double dtdy);
   void filter_pixel(RGBColord &rgb, double &alpha,
-		    double s, double t, double radius);
+                    double s, double t, double radius);
 
   void read_input();
 };

+ 8 - 8
pandaapp/src/stitchviewer/stitchImageConverter.cxx

@@ -29,7 +29,7 @@ add_output_image(StitchImage *image) {
 void StitchImageConverter::
 override_chan_cfg(ChanCfgOverrides &override) {
   override.setField(ChanCfgOverrides::Mask,
-		    ((unsigned int)(W_DOUBLE|W_DEPTH|W_MULTISAMPLE)));
+                    ((unsigned int)(W_DOUBLE|W_DEPTH|W_MULTISAMPLE)));
   override.setField(ChanCfgOverrides::Title, "Stitch");
 
   LVecBase2d size = _output_image->get_size_pixels();
@@ -73,12 +73,12 @@ create_image_geometry(Image &im) {
   for (int xi = 0; xi < x_verts; xi++) {
     for (int yi = 0; yi < y_verts; yi++) {
       LVector2d uvd =
-	im._image->project(_output_image->get_grid_vector(xi, yi));
+        im._image->project(_output_image->get_grid_vector(xi, yi));
       LVector2f uvf(uvd);
 
       LVector3f p = LVector3f::rfu(2 * (double)xi / (double)(x_verts - 1) - 1,
-				   1.0,
-				   1 - 2 * (double)yi / (double)(y_verts - 1));
+                                   1.0,
+                                   1 - 2 * (double)yi / (double)(y_verts - 1));
       mesh._coords.push_back(p);
       mesh._texcoords.push_back(uvf);
     }
@@ -91,13 +91,13 @@ create_image_geometry(Image &im) {
   for (int xi = 0; xi < x_verts; xi++) {
     for (int yi = 0; yi < y_verts; yi++) {
       LVector2d uvd = 
-	_output_image->project(im._image->get_grid_vector(xi, yi));
+        _output_image->project(im._image->get_grid_vector(xi, yi));
 
       LVector3f p = LVector3f::rfu(2 * uvd[0] - 1,
-				   1.0,
-				   2 * uvd[1] - 1);
+                                   1.0,
+                                   2 * uvd[1] - 1);
       LPoint2f uvf((double)xi / (double)(x_verts - 1),
-		   1.0 - (double)yi / (double)(y_verts - 1));
+                   1.0 - (double)yi / (double)(y_verts - 1));
       mesh._coords.push_back(p);
       mesh._texcoords.push_back(uvf);
     }

+ 4 - 4
pandaapp/src/stitchviewer/stitchImageVisualizer.cxx

@@ -70,8 +70,8 @@ Image(StitchImage *image, int index, bool scale) :
 
     if (new_xsize != old_xsize || new_ysize != old_ysize) {
       nout << "Scaling " << image->get_name() << " from " 
-	   << old_xsize << " " << old_ysize << " to "
-	   << new_xsize << " " << new_ysize << "\n";
+           << old_xsize << " " << old_ysize << " to "
+           << new_xsize << " " << new_ysize << "\n";
       
       PNMImage *n = new PNMImage(new_xsize, new_ysize);
       n->quick_filter_from(*image->_data);
@@ -217,7 +217,7 @@ setup() {
 void StitchImageVisualizer::
 override_chan_cfg(ChanCfgOverrides &override) {
   override.setField(ChanCfgOverrides::Mask,
-		    ((unsigned int)(W_DOUBLE|W_DEPTH|W_MULTISAMPLE)));
+                    ((unsigned int)(W_DOUBLE|W_DEPTH|W_MULTISAMPLE)));
   override.setField(ChanCfgOverrides::Title, "Stitch");
 }
 
@@ -264,7 +264,7 @@ create_image_geometry(StitchImageVisualizer::Image &im) {
   for (int xi = 0; xi < x_verts; xi++) {
     for (int yi = 0; yi < y_verts; yi++) {
       LPoint2d uv = LPoint2d((double)xi / (double)(x_verts - 1),
-			     1.0 - (double)yi / (double)(y_verts - 1));
+                             1.0 - (double)yi / (double)(y_verts - 1));
       LVector3d p = im._image->extrude(uv);
 
       mesh._coords.push_back(LCAST(float, p) * scale);

+ 1 - 1
pandaapp/src/stitchviewer/stitchImageVisualizer.h

@@ -24,7 +24,7 @@ class PNMImage;
 class ChanCfgOverrides;
 
 class StitchImageVisualizer : public StitchImageOutputter,
-			      public GraphicsWindow::Callback {
+                              public GraphicsWindow::Callback {
 public:
   StitchImageVisualizer();
   virtual void add_input_image(StitchImage *image);