col 601 B

123456789101112131415161718192021222324
  1. # test
  2. /* color nodes using output of dijkstra */
  3. BEG_G {
  4. double h, hn, hf, d, sat, md = maxdist;
  5. if (hue_near =="") hue_near = 0.8;
  6. if (hue_far =="") hue_far = 1.2;
  7. hn = hue_near;
  8. hf = hue_far;
  9. }
  10. # test
  11. N {
  12. d = dist;
  13. sat = (md - d + 1.0) /( md + 1.0);
  14. h = hn + ((hf - hn) * d)/md;
  15. while (h < 0.0) h = h + 1.0;
  16. while (h > 1.0) h = h - 1.0;
  17. color = sprintf("%lf %lf %lf",hue,sat,1.0);
  18. /* make sure the shape is filled */
  19. if (!match(style,"filled")>=0) {
  20. if (style != "") style=sprintf("%s,filled",style);
  21. else style="filled";
  22. }
  23. }