transformPoint method
Implementation
MapPoint transformPoint(Matrix4 transform, MapPoint point) {
final Float64List storage = transform.storage;
final double x = point.x;
final double y = point.y;
// Directly simulate the transform of the vector (x, y, 0, 1),
// dropping the resulting Z coordinate, and normalizing only
// if needed.
final double rx = storage[0] * x + storage[4] * y + storage[12];
final double ry = storage[1] * x + storage[5] * y + storage[13];
final double rw = storage[3] * x + storage[7] * y + storage[15];
if (rw == 1.0) {
return MapPoint(rx, ry);
} else {
return MapPoint(rx / rw, ry / rw);
}
}