SHARE
TWEET

Untitled

a guest Nov 22nd, 2019 85 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. point* skala(point* coordinates, int size) {
  2.     double x, y, skala, A, aS, Ax = 0, Ay = 0, ax=0, ay=0;
  3.     point* cord = new point[size];
  4.     int kon=0;
  5.     cout << "Podaj wspolczynnik skali w procentach(przyklad 70%= 0.7): ";
  6.     cin >> skala;
  7.  
  8.     for (int i = 0; i < size; i++) {
  9.         Ax = Ax + coordinates[i].x;
  10.         Ay = Ay + coordinates[i].y;
  11.     }
  12.     Ax = Ax / size;
  13.     Ay = Ay / size;
  14.  
  15.     cout << "Nowy srodek: " << Ax << " " << Ay << endl;
  16.  
  17.     for (int i = 0; i < size; i++) {
  18.         cord[i].x = coordinates[i].x * skala;
  19.         cord[i].y = coordinates[i].y * skala;
  20.     }
  21.     for (int i = 0; i < size; i++) {
  22.         ax = ax + cord[i].x;
  23.         ay = ay + cord[i].y;
  24.     }
  25.     ax = ax / size;
  26.     ay = ay / size;
  27.  
  28.     cout << "nowy srodek: " << ax << " " << ay << endl;
  29.  
  30.     ax = ax - Ax;
  31.     ay = ay - Ay;
  32.  
  33.     cout << "nowy srodek: " << ax << " " << ay << endl;
  34.  
  35.     for (int i = 0; i < size; i++) {
  36.         coordinates[i].x = coordinates[i].x + ax;
  37.         coordinates[i].y = coordinates[i].y + ay;
  38.     }
  39. getchar(); getchar();
  40.     return coordinates;
  41. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top