Example #1
0
Point TranslateCoordinates(Point p, Rect world, Rect view) {
  Point cw = world.Center();
  Point slope = p.Add(cw).Sub(view.Center());
  Point scaleFactor = world.ScaleFactorFor(view).Mul(1, -1);
  return scaleFactor.Mul(slope).Add(cw);
  //  return Point(
  //     sf.x * (p.x + cw.x - cv.x) + cw.x,
  //    -sf.y * (p.y + cw.y - cv.y) + cw.y
  //  );
}