vectorToPolarOptimized static method

ILatLng vectorToPolarOptimized(
  1. Float32x4 vector
)

Implementation

static ILatLng vectorToPolarOptimized(Float32x4 vector) {
  var xxxx = vector.shuffle(Float32x4.xxxx);
  var yyyy = vector.shuffle(Float32x4.yyyy);

  var powerX = xxxx * xxxx;
  var powerY = yyyy * yyyy;

  var sum = powerX + powerY;

  var sqrt = sum.sqrt();

  final lat = math.atan2(vector.z, sqrt.x);
  final lng = math.atan2(vector.y, vector.x);

  return LatLngInfo(lat.degrees, lng.degrees, MarkerId(''));
}