示例#1
0
        /**
         * Sets the normal vector for this cell. Also modifies all other cell
         * properties related to the normal vector, such as fault strike and dip.
         */
        internal void setNormalVector(float w1, float w2, float w3)
        {
            float fp = FaultGeometry.faultStrikeFromNormalVector(w1, w2, w3);
            float ft = FaultGeometry.faultDipFromNormalVector(w1, w2, w3);

            set(x1, x2, x3, fl, fp, ft);
        }
示例#2
0
        /////////////////////////////////////////////////////////////////////////
        // private

        private void set(
            float x1, float x2, float x3,
            float fl, float fp, float ft)
        {
            this.x1 = x1;
            this.x2 = x2;
            this.x3 = x3;
            this.fl = fl;
            this.fp = fp;
            this.ft = ft;
            i1      = (int)Math.Round(x1);
            i2      = (int)Math.Round(x2);
            i3      = (int)Math.Round(x3);
            float[] u = FaultGeometry.faultDipVectorFromStrikeAndDip(fp, ft);
            float[] v = FaultGeometry.faultStrikeVectorFromStrikeAndDip(fp, ft);
            float[] w = FaultGeometry.faultNormalVectorFromStrikeAndDip(fp, ft);
            u1 = u[0]; u2 = u[1]; u3 = u[2]; us = 1.0f / u1;
            v1 = v[0]; v2 = v[1]; v3 = v[2];
            w1 = w[0]; w2 = w[1]; w3 = w[2];

            // Indices (i2m,i2p) and (i3m,i3p) for minus-plus pairs of samples.
            // Cell normal vector w points from the minus side to the plus side.
            i2m = i2p = i2;
            i3m = i3p = i3;
            if (x2 > i2)
            {
                ++i2p;
            }
            else if (x2 < i2)
            {
                --i2m;
            }
            if (x3 > i3)
            {
                ++i3p;
            }
            else if (x3 < i3)
            {
                --i3m;
            }
            if ((i2p - i2m) * w2 < 0.0f)
            {
                int i2t = i2m;
                i2m = i2p;
                i2p = i2t;
            }
            if ((i3p - i3m) * w3 < 0.0f)
            {
                int i3t = i3m;
                i3m = i3p;
                i3p = i3t;
            }
        }