From: Ian Jackson Date: Wed, 2 Jan 2008 21:25:22 +0000 (+0000) Subject: remove dead wood; reenable graph_layout_cost X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=moebius2.git;a=commitdiff_plain;h=8e877646039cbcce06ad506f60a73785abbb3e56 remove dead wood; reenable graph_layout_cost --- diff --git a/energy.c b/energy.c index 8961f54..9887ccb 100644 --- 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;