chiark / gitweb /
remove dead wood; reenable graph_layout_cost
authorIan Jackson <ian@davenant.greenend.org.uk>
Wed, 2 Jan 2008 21:25:22 +0000 (21:25 +0000)
committerIan Jackson <ian@davenant.greenend.org.uk>
Wed, 2 Jan 2008 21:25:22 +0000 (21:25 +0000)
energy.c

index 8961f549979ddf5eed7f0b5c9773b67d1d442df0..9887ccb394fe1c09825287758599655ae2649430 100644 (file)
--- a/energy.c
+++ b/energy.c
@@ -28,7 +28,7 @@ static double compute_energy(const Vertices vertices) {
   printf("cost > energy |");
 
   COST(1e4, edgewise_vertex_displacement_cost(vertices));
-//  COST(1e2, graph_layout_cost(vertices,vertex_areas));
+  COST(1e2, graph_layout_cost(vertices,vertex_areas));
 //  COST(1e4, noncircular_rim_cost(vertices));
 
   printf("| total %# e |", energy);
@@ -221,7 +221,7 @@ int main(int argc, const char *const *argv) {
    */
 
 double edgewise_vertex_displacement_cost(const Vertices vertices) {
-  static const double /*d_epsilon= 1e-6,*/ axb_epsilon= 1e-6;
+  static const double axb_epsilon= 1e-6;
 
   int pi,e,qi,ri,si, k;
   double m[D3], a[D3], b[D3], axb[D3];
@@ -237,12 +237,8 @@ double edgewise_vertex_displacement_cost(const Vertices vertices) {
 
     xprod(axb,a,b);
     
-    double l= 1; //hypotD(vertices[pi], vertices[qi]);
-    double d= 1; //hypotD(vertices[ri], vertices[si]) + d_epsilon;
     double delta= atan2(magnD(axb) + axb_epsilon, dotprod(a,b));
-    
-    double cost= l * delta * delta / d;
-
+    double cost= delta * delta;
     total_cost += cost;
   }
   return total_cost;