[Lemon-commits] [lemon_svn] alpar: r1614 - hugo/trunk/src/lemon

Lemon SVN svn at lemon.cs.elte.hu
Mon Nov 6 20:46:35 CET 2006


Author: alpar
Date: Mon Mar  7 08:53:20 2005
New Revision: 1614

Modified:
   hugo/trunk/src/lemon/graph_to_eps.h
   hugo/trunk/src/lemon/xy.h

Log:
- rot90() and rot270() added to xy.h
- graph_to_eps.h's own rot() func. replaced to this

Modified: hugo/trunk/src/lemon/graph_to_eps.h
==============================================================================
--- hugo/trunk/src/lemon/graph_to_eps.h	(original)
+++ hugo/trunk/src/lemon/graph_to_eps.h	Mon Mar  7 08:53:20 2005
@@ -157,7 +157,6 @@
 ///Returns black for light colors and white for the dark ones.
 ///\todo weighted average would be better
 inline Color distantBW(const Color &c){
-  //  double v=(c.getR()+c.getG()+c.getB())<1.5?1:0;
   double v=(.2125*c.getR()+.7154*c.getG()+.0721*c.getB())<.5?1:0;
   return Color(v,v,v);
 }
@@ -327,10 +326,6 @@
     return (g.source(e)==g.source(f)&&g.target(e)==g.target(f))||
       (g.source(e)==g.target(f)&&g.target(e)==g.source(f));
   }
-  static xy<double> rot(xy<double> v) 
-  {
-    return xy<double>(v.y,-v.x);
-  }
   template<class TT>
   static std::string psOut(const xy<TT> &p) 
     {
@@ -775,7 +770,7 @@
 
 	  for(typename std::vector<Edge>::iterator e=i;e!=j;++e) {
 	    sw+=_edgeWidths[*e]*_edgeWidthScale/2.0;
-	    xy<double> mm=m+rot(d)*sw/.75;
+	    xy<double> mm=m+rot90(d)*sw/.75;
 	    if(_drawArrows) {
 	      int node_shape;
 	      xy<double> s=_coords[g.source(*e)];
@@ -811,7 +806,7 @@
 		 << bez.p2.x << ' ' << bez.p2.y << ' '
 		 << bez.p3.x << ' ' << bez.p3.y << ' '
 		 << bez.p4.x << ' ' << bez.p4.y << " curveto stroke\n";
-	      xy<double> dd(rot(linend-apoint));
+	      xy<double> dd(rot90(linend-apoint));
 	      dd*=(.5*_edgeWidths[*e]*_edgeWidthScale+_arrowWidth)/
 		sqrt(dd.normSquare());
 	      os << "newpath " << psOut(apoint) << " moveto "

Modified: hugo/trunk/src/lemon/xy.h
==============================================================================
--- hugo/trunk/src/lemon/xy.h	(original)
+++ hugo/trunk/src/lemon/xy.h	Mon Mar  7 08:53:20 2005
@@ -180,6 +180,29 @@
     return os;
   }
 
+  ///Rotate by 90 degrees
+
+  ///Returns its parameter rotated by 90 degrees in positive direction.
+  ///\relates xy
+  ///
+  template<typename T>
+  inline xy<T> rot90(const xy<T> &z)
+  {
+    return xy<T>(-z.y,z.x);
+  }
+
+  ///Rotate by 270 degrees
+
+  ///Returns its parameter rotated by 90 degrees in negative direction.
+  ///\relates xy
+  ///
+  template<typename T>
+  inline xy<T> rot270(const xy<T> &z)
+  {
+    return xy<T>(z.y,-z.x);
+  }
+
+  
 
   /// A class to calculate or store the bounding box of plainvectors.
 



More information about the Lemon-commits mailing list