getRadians static method

double getRadians(
  1. String direction
)

获取弧度

Implementation

static double getRadians(String direction) {
  double radians = 0;

  if (direction == DFDirection.DOWN_RIGHT) {
    radians = 45 * pi / 180.0;
  } else if (direction == DFDirection.UP_LEFT) {
    radians = 225 * pi / 180.0;
  } else if (direction == DFDirection.UP_RIGHT) {
    radians = 315 * pi / 180.0;
  } else if (direction == DFDirection.DOWN_LEFT) {
    radians = 135 * pi / 180.0;
  } else if (direction == DFDirection.RIGHT) {
    radians = 0;
  } else if (direction == DFDirection.LEFT) {
    radians = 180 * pi / 180.0;
  } else if (direction == DFDirection.DOWN) {
    radians = 90 * pi / 180.0;
  } else if (direction == DFDirection.UP) {
    radians = 270 * pi / 180.0;
  }

  /// 返回结果
  return radians;
}