computeRadius method

List<num> computeRadius(
  1. Graph graph,
  2. num width,
  3. num height
)

计算半径

Implementation

List<num> computeRadius(Graph graph, num width, num height) {
  num startR;
  num endR;
  num rStep;
  num size = m.min(width, height);
  if (radius != null) {
    num mv = radius!.convert(size);
    startR = endR = mv;
    rStep = 0;
  } else {
    if (startRadius != null) {
      startR = startRadius!.convert(size);
    } else {
      startR = size * 0.5;
    }
    if (endRadius != null) {
      endR = endRadius!.convert(size);
    } else {
      endR = size * 0.5;
    }
    if (startR > endR) {
      var t = endR;
      endR = startR;
      startR = t;
    }
    if (graph.nodes.length <= 1) {
      rStep = 1;
    } else {
      rStep = (endR - startR) / (graph.nodes.length - 1);
    }
  }
  return [startR, endR, rStep];
}