Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace WindowsFormsApplication4
- {
- class Skala
- {
- public double A, B, C, D;
- public double E, F, G, H;
- public Skala( int xe0, int ye0, int eszer, int ewys, double xr0, double yr0, double rszer, double rwys)
- {
- A = (double) eszer / rszer; //z przestrzeni na ekran
- B = (double) xe0 - A * (xr0 - rszer / 2.0);
- C = -(double)ewys / rwys;
- D = (double) ye0 - C * (yr0 + rwys / 2.0);
- E = rszer / (double)eszer; //z ekranu do przestrzeni
- F = xr0 - rszer / 2.0 - E * (double)xe0;
- G = -rwys / (double)ewys;
- H = yr0 + rwys / 2.0 - G * (double)ye0;
- }
- public Skala( int xe0, int eszer, double xr0, double rszer)
- {
- A = (double) eszer / rszer; //z przestrzeni na ekran
- B = (double) xe0 - A * (xr0 - rszer / 2.0);
- C = 0;
- D = 0;
- E = rszer / (double)eszer; //z ekranu do przestrzeni
- F = xr0 - rszer / 2.0 - E * (double)xe0;
- G = 0;
- H = 0;
- }
- public double daj_real_x(int xe)
- {
- return E * xe + F;
- }
- public double daj_real_y(int ye)
- {
- return G * ye + H;
- }
- public int daj_ekr_x(double x)
- {
- return (int)(A * x + B);
- }
- public int daj_ekr_y(double y)
- {
- return (int)(C * y + D);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment