toVector3 static method

Vector3 toVector3(
  1. double lat,
  2. double lng
)

Implementation

static Vector3 toVector3(double lat, double lng) {
  var latRad = MathUtil.toRadians(lat).toDouble();
  var lonRad = MathUtil.toRadians(lng).toDouble();
  var x = math.cos(lonRad) * math.cos(latRad);
  var y = math.sin(lonRad) * math.cos(latRad);
  var z = math.sin(latRad);

  return Vector3(x, y, z);
}