Example #1
0
            public static double[] LinearSystemSolve(Vector r, Vector u, Vector v, Vector w)
            {
                double num     = (double)(u * Vector.Cross(v, w));
                double num2    = 1.0 / num;
                Vector vector  = (Vector)(num2 * Vector.Cross(v, w));
                Vector vector2 = (Vector)(num2 * Vector.Cross(w, u));
                Vector vector3 = (Vector)(num2 * Vector.Cross(u, v));
                double num3    = (double)(r * vector);
                double num4    = (double)(r * vector2);
                double num5    = (double)(r * vector3);

                return(new double[] { num3, num4, num5 });
            }
Example #2
0
        public Orientation(Vector axisX, Vector axisY)
        {
            Vector u = Vector.UnitCross(axisX, axisY);

            axisX     = Vector.Unit(axisX);
            axisY     = Vector.Cross(u, axisX);
            this.m_Xx = axisX.X;
            this.m_Xy = axisX.Y;
            this.m_Xz = axisX.Z;
            this.m_Yx = axisY.X;
            this.m_Yy = axisY.Y;
            this.m_Yz = axisY.Z;
            this.m_Zx = u.X;
            this.m_Zy = u.Y;
            this.m_Zz = u.Z;
        }
Example #3
0
                private void ComputeVectors(double[,] A, Vector U2, int i0, int i1, int i2)
                {
                    Vector vector;
                    Vector vector2;
                    double num4;

                    this.GenerateComplementBasis(out vector, out vector2, U2);
                    Vector vector3 = new Vector(Snap.Math.MatrixMath.Multiply(A, vector.Array));
                    double num     = this.mEigenvalue[i2] - (vector * vector3);
                    double num2    = (double)(vector2 * vector3);
                    Vector vector4 = new Vector(Snap.Math.MatrixMath.Multiply(A, vector2.Array));
                    double num3    = this.mEigenvalue[i2] - (vector2 * vector4);
                    double num5    = System.Math.Abs(num);
                    int    num6    = 0;
                    double num7    = System.Math.Abs(num2);

                    if (num7 > num5)
                    {
                        num5 = num7;
                    }
                    num7 = System.Math.Abs(num3);
                    if (num7 > num5)
                    {
                        num5 = num7;
                        num6 = 1;
                    }
                    if (num5 >= 1E-08)
                    {
                        if (num6 == 0)
                        {
                            num4  = 1.0 / System.Math.Sqrt((num * num) + (num2 * num2));
                            num  *= num4;
                            num2 *= num4;
                            this.mEigenvector[i2] = (Vector)((num2 * vector) + (num * vector2));
                        }
                        else
                        {
                            num4  = 1.0 / System.Math.Sqrt((num3 * num3) + (num2 * num2));
                            num3 *= num4;
                            num2 *= num4;
                            this.mEigenvector[i2] = (Vector)((num3 * vector) + (num2 * vector2));
                        }
                    }
                    else if (num6 == 0)
                    {
                        this.mEigenvector[i2] = vector2;
                    }
                    else
                    {
                        this.mEigenvector[i2] = vector;
                    }
                    Vector vector5 = Vector.Cross(U2, this.mEigenvector[i2]);

                    vector3 = new Vector(Snap.Math.MatrixMath.Multiply(A, U2.Array));
                    num     = this.mEigenvalue[i0] - (U2 * vector3);
                    num2    = (double)(vector5 * vector3);
                    Vector vector6 = new Vector(Snap.Math.MatrixMath.Multiply(A, vector5.Array));

                    num3 = this.mEigenvalue[i0] - (vector5 * vector6);
                    num5 = System.Math.Abs(num);
                    num6 = 0;
                    num7 = System.Math.Abs(num2);
                    if (num7 > num5)
                    {
                        num5 = num7;
                    }
                    num7 = System.Math.Abs(num3);
                    if (num7 > num5)
                    {
                        num5 = num7;
                        num6 = 1;
                    }
                    if (num5 >= 1E-08)
                    {
                        if (num6 == 0)
                        {
                            num4  = 1.0 / System.Math.Sqrt((num * num) + (num2 * num2));
                            num  *= num4;
                            num2 *= num4;
                            this.mEigenvector[i0] = (Vector)((num2 * U2) + (num * vector5));
                        }
                        else
                        {
                            num4  = 1.0 / System.Math.Sqrt((num3 * num3) + (num2 * num2));
                            num3 *= num4;
                            num2 *= num4;
                            this.mEigenvector[i0] = (Vector)((num3 * U2) + (num2 * vector5));
                        }
                    }
                    else if (num6 == 0)
                    {
                        this.mEigenvector[i0] = vector5;
                    }
                    else
                    {
                        this.mEigenvector[i0] = U2;
                    }
                    this.mEigenvector[i1] = Vector.Cross(this.mEigenvector[i2], this.mEigenvector[i0]);
                }