home *** CD-ROM | disk | FTP | other *** search
/ PC Online 1997 October / PCO1097.ISO / FilesBBS / FREI / RING.EXE / MyFactorRotatie.class (.txt) < prev    next >
Encoding:
Java Class File  |  1997-02-15  |  2.7 KB  |  134 lines

  1. import java.applet.Applet;
  2.  
  3. class MyFactorRotatie extends Applet {
  4.    int[] point;
  5.    // $FF: renamed from: ic int
  6.    private int field_0;
  7.    private int smin;
  8.    private int smax;
  9.    // $FF: renamed from: wh int
  10.    private int field_1;
  11.    private int sw2;
  12.    private int dw2;
  13.    // $FF: renamed from: x int
  14.    private int field_2;
  15.    // $FF: renamed from: y int
  16.    private int field_3;
  17.    // $FF: renamed from: xx int
  18.    private int field_4;
  19.    // $FF: renamed from: yy int
  20.    private int field_5;
  21.    private double cosHoek;
  22.    private double sinHoek;
  23.    // $FF: renamed from: f double
  24.    private double field_6;
  25.  
  26.    private void go270() {
  27.       int dm = this.dw2 / 2;
  28.       int sm = this.sw2 / 2;
  29.       this.field_1 = (this.dw2 - this.sw2) / 2;
  30.  
  31.       for(this.field_2 = 0; this.field_2 < this.dw2 * this.dw2 - 1; ++this.field_2) {
  32.          this.point[this.field_2] = this.field_0;
  33.       }
  34.  
  35.       for(this.field_2 = 0; this.field_2 < this.sw2; ++this.field_2) {
  36.          for(this.field_3 = 0; this.field_3 < this.sw2; ++this.field_3) {
  37.             this.field_5 = (int)(this.field_6 * (double)(this.sw2 - 1 - this.field_2 - sm)) + dm;
  38.             this.field_4 = (int)(this.field_6 * (double)(this.field_3 - sm)) + dm;
  39.             this.point[this.field_5 * this.dw2 + this.field_4] = this.field_3 * this.sw2 + this.field_2;
  40.          }
  41.       }
  42.  
  43.    }
  44.  
  45.    private void gonormal() {
  46.       for(this.field_2 = 1; this.field_2 < this.dw2 * this.dw2 - 1; ++this.field_2) {
  47.          this.point[this.field_2] = -1;
  48.       }
  49.  
  50.       this.point[0] = this.field_0;
  51.       this.point[this.dw2 * this.dw2 - 1] = this.field_0;
  52.  
  53.       for(this.field_2 = this.smin; this.field_2 < this.smax + 1; ++this.field_2) {
  54.          for(this.field_3 = this.smin; this.field_3 < this.smax + 1; ++this.field_3) {
  55.             this.field_4 = (int)(this.field_6 * (double)this.field_2 * this.cosHoek - this.field_6 * (double)this.field_3 * this.sinHoek) + this.field_1;
  56.             this.field_5 = (int)(this.field_6 * (double)this.field_2 * this.sinHoek + this.field_6 * (double)this.field_3 * this.cosHoek) + this.field_1;
  57.             this.point[this.field_5 * this.dw2 + this.field_4] = (this.field_3 - this.smin) * this.sw2 + this.field_2 - this.smin;
  58.          }
  59.       }
  60.  
  61.       for(this.field_2 = 1; this.field_2 < this.dw2 * this.dw2 - 1; ++this.field_2) {
  62.          if (this.point[this.field_2] == -1) {
  63.             if (this.point[this.field_2 + 1] != -1) {
  64.                this.point[this.field_2] = this.point[this.field_2 + 1];
  65.             } else {
  66.                this.point[this.field_2] = this.field_0;
  67.             }
  68.          }
  69.       }
  70.  
  71.    }
  72.  
  73.    MyFactorRotatie(int IndexColor, int sw, int dw, double sinusHoek, double cosinusHoek, double factor) {
  74.       this.point = new int[dw * dw];
  75.       this.smin = -sw / 2 + 1;
  76.       this.smax = sw / 2;
  77.       this.field_1 = dw / 2;
  78.       this.field_6 = factor;
  79.       this.sw2 = sw;
  80.       this.dw2 = dw;
  81.       this.cosHoek = cosinusHoek;
  82.       this.sinHoek = sinusHoek;
  83.       this.field_0 = IndexColor;
  84.       if (sinusHoek == (double)1.0F) {
  85.          this.go90();
  86.       } else if (cosinusHoek == (double)-1.0F) {
  87.          this.go180();
  88.       } else if (sinusHoek == (double)-1.0F) {
  89.          this.go270();
  90.       } else {
  91.          this.gonormal();
  92.       }
  93.  
  94.    }
  95.  
  96.    private void go90() {
  97.       int dm = this.dw2 / 2;
  98.       int sm = this.sw2 / 2;
  99.       this.field_1 = (this.dw2 - this.sw2) / 2;
  100.  
  101.       for(this.field_2 = 0; this.field_2 < this.dw2 * this.dw2 - 1; ++this.field_2) {
  102.          this.point[this.field_2] = this.field_0;
  103.       }
  104.  
  105.       for(this.field_2 = 0; this.field_2 < this.sw2; ++this.field_2) {
  106.          for(this.field_3 = 0; this.field_3 < this.sw2; ++this.field_3) {
  107.             this.field_5 = (int)(this.field_6 * (double)(this.field_2 - sm)) + dm;
  108.             this.field_4 = (int)(this.field_6 * (double)(this.sw2 - 1 - this.field_3 - sm)) + dm;
  109.             this.point[this.field_5 * this.dw2 + this.field_4] = this.field_3 * this.sw2 + this.field_2;
  110.          }
  111.       }
  112.  
  113.    }
  114.  
  115.    private void go180() {
  116.       int dm = this.dw2 / 2;
  117.       int sm = this.sw2 / 2;
  118.       this.field_1 = (this.dw2 - this.sw2) / 2;
  119.  
  120.       for(this.field_2 = 0; this.field_2 < this.dw2 * this.dw2 - 1; ++this.field_2) {
  121.          this.point[this.field_2] = this.field_0;
  122.       }
  123.  
  124.       for(this.field_2 = 0; this.field_2 < this.sw2; ++this.field_2) {
  125.          for(this.field_3 = 0; this.field_3 < this.sw2; ++this.field_3) {
  126.             this.field_5 = (int)(this.field_6 * (double)(this.sw2 - 1 - this.field_3 - sm)) + dm;
  127.             this.field_4 = (int)(this.field_6 * (double)(this.sw2 - 1 - this.field_2 - sm)) + dm;
  128.             this.point[this.field_5 * this.dw2 + this.field_4] = this.field_3 * this.sw2 + this.field_2;
  129.          }
  130.       }
  131.  
  132.    }
  133. }
  134.