コード例 #1
0
ファイル: TimeMarker3.java プロジェクト: amunoz1/jtk
 void push(int k) {
   if (_n == _a.length) {
     short[] a = new short[2 * _n];
     System.arraycopy(_a, 0, a, 0, _n);
     _a = a;
   }
   _a[_n++] = (short) k;
 }
コード例 #2
0
ファイル: DirectionalSurvey.java プロジェクト: amunozNFX/xmw
    public Locater(double xe, double yn, double ze, double[] z, double[] t, double[] p) {
      int n = z.length;

      // Sort directional data by increasing measured depth. This sort
      // facilitates binary search for the measured depth interval that
      // contains a measured depth at which we compute well bore coordinates.
      int[] j = rampint(0, 1, n);
      quickIndexSort(z, j);
      z = sort(z, j);
      t = sort(t, j);
      p = sort(p, j);

      // If smallest depth not zero, then insert data for depth zero.
      // Assume that both inclination and azimuth are zero at depth zero.
      if (z[0] != 0.0) {
        double[] ztemp = new double[n + 1];
        double[] ttemp = new double[n + 1];
        double[] ptemp = new double[n + 1];
        System.arraycopy(z, 0, ztemp, 1, n);
        System.arraycopy(t, 0, ttemp, 1, n);
        System.arraycopy(p, 0, ptemp, 1, n);
        z = ztemp;
        t = ttemp;
        p = ptemp;
        ++n;
      }
      _n = n;

      // Parameters at measured depths required for interpolation.
      _a = new double[n];
      _zm = new double[n];
      _xp = new double[n];
      _yp = new double[n];
      _zp = new double[n];
      _xt = new double[n];
      _yt = new double[n];
      _zt = new double[n];
      _xp[0] = xe;
      _yp[0] = yn;
      _zp[0] = ze;
      for (int i = 0, im1 = 0; i < n; ++i, im1 = i - 1) {
        double t1 = toRadians(t[im1]);
        double t2 = toRadians(t[i]);
        double p1 = toRadians(p[im1]);
        double p2 = toRadians(p[i]);
        double ct1 = cos(t1);
        double ct2 = cos(t2);
        double cp1 = cos(p1);
        double cp2 = cos(p2);
        double st1 = sin(t1);
        double st2 = sin(t2);
        double sp1 = sin(p1);
        double sp2 = sin(p2);
        double sdt = sin(0.5 * (t2 - t1));
        double sdp = sin(0.5 * (p2 - p1));
        double a = 2.0 * asin(sqrt(sdt * sdt + st1 * st2 * sdp * sdp));
        double scale = 0.5 * shapeFactor(a) * (z[i] - z[im1]);
        _a[i] = a;
        _zm[i] = z[i];
        _xt[i] = st2 * sp2;
        _yt[i] = st2 * cp2;
        _zt[i] = ct2;
        if (i == 0) {
          _xp[i] = xe;
          _yp[i] = yn;
          _zp[i] = ze;
        } else {
          _xp[i] = _xp[im1] + scale * (_xt[i - 1] + _xt[i]);
          _yp[i] = _yp[im1] + scale * (_yt[i - 1] + _yt[i]);
          _zp[i] = _zp[im1] - scale * (_zt[i - 1] + _zt[i]);
        }
      }
    }
コード例 #3
0
ファイル: TimeMarker3.java プロジェクト: amunoz1/jtk
 short[] array() {
   short[] a = new short[_n];
   System.arraycopy(_a, 0, a, 0, _n);
   return a;
 }
コード例 #4
0
ファイル: TimeMarker3.java プロジェクト: amunoz1/jtk
 private void growTo(int capacity) {
   Sample[] a = new Sample[capacity];
   System.arraycopy(_a, 0, a, 0, _n);
   _a = a;
 }