Beispiel #1
0
 public Matrix2LR(LongRational[] elements)
 {
     this.M00 = elements[0];
     this.M01 = elements[1];
     this.M10 = elements[2];
     this.M11 = elements[3];
 }
Beispiel #2
0
 public Matrix2LR(Vector2LR column1, Vector2LR column2)
 {
     this.M00 = column1.X;
     this.M01 = column2.X;
     this.M10 = column1.Y;
     this.M11 = column2.Y;
 }
Beispiel #3
0
 public Matrix2LR(IList <LongRational> elements)
 {
     this.M00 = elements[0];
     this.M01 = elements[1];
     this.M10 = elements[2];
     this.M11 = elements[3];
 }
Beispiel #4
0
        public Matrix3LR GetInverse(out bool couldInvert)
        {
            LongRational determinant = this.GetDeterminant();

            couldInvert = !determinant.IsZero;
            return(new Matrix3LR((this.M11 * this.M22 - this.M12 * this.M21) / determinant, -(this.M01 * this.M22 - this.M02 * this.M21) / determinant, (this.M01 * this.M12 - this.M02 * this.M11) / determinant, -(this.M10 * this.M22 - this.M12 * this.M20) / determinant, (this.M00 * this.M22 - this.M02 * this.M20) / determinant, -(this.M00 * this.M12 - this.M02 * this.M10) / determinant, (this.M10 * this.M21 - this.M11 * this.M20) / determinant, -(this.M00 * this.M21 - this.M01 * this.M20) / determinant, (this.M00 * this.M11 - this.M01 * this.M10) / determinant));
        }
Beispiel #5
0
 public Matrix2LR(Matrix2LR m)
 {
     this.M00 = m.M00;
     this.M01 = m.M01;
     this.M10 = m.M10;
     this.M11 = m.M11;
 }
Beispiel #6
0
 public Vector4LR(Vector4LR from)
 {
     this.X = from.X;
     this.Y = from.Y;
     this.Z = from.Z;
     this.W = from.W;
 }
Beispiel #7
0
        public LongRational this[int index]
        {
            get
            {
                switch (index)
                {
                case 0:
                    return(this.X);

                case 1:
                    return(this.Y);

                default:
                    throw new IndexOutOfRangeException();
                }
            }
            set
            {
                switch (index)
                {
                case 0:
                    this.X = value;
                    break;

                case 1:
                    this.Y = value;
                    break;

                default:
                    throw new IndexOutOfRangeException();
                }
            }
        }
Beispiel #8
0
 public Vector4LR(int x, int y, int z, int w)
 {
     this.X = new LongRational(x);
     this.Y = new LongRational(y);
     this.Z = new LongRational(z);
     this.W = new LongRational(w);
 }
Beispiel #9
0
 public Vector4LR(IList <LongRational> coordinates)
 {
     this.X = coordinates[0];
     this.Y = coordinates[1];
     this.Z = coordinates[2];
     this.W = coordinates[3];
 }
Beispiel #10
0
 public Vector4LR(double x, double y, double z, double w)
 {
     this.X = (LongRational)x;
     this.Y = (LongRational)y;
     this.Z = (LongRational)z;
     this.W = (LongRational)w;
 }
Beispiel #11
0
 public Vector4LR(LongRational x, LongRational y, LongRational z, LongRational w)
 {
     this.X = x;
     this.Y = y;
     this.Z = z;
     this.W = w;
 }
Beispiel #12
0
 public Matrix2LR(LongRational m00, LongRational m01, LongRational m10, LongRational m11)
 {
     this.M00 = m00;
     this.M01 = m01;
     this.M10 = m10;
     this.M11 = m11;
 }
Beispiel #13
0
        public Matrix2LR GetInverse(out bool couldInvert)
        {
            LongRational determinant = this.GetDeterminant();

            couldInvert = !determinant.IsZero;
            return(new Matrix2LR(this.M11 / determinant, -this.M01 / determinant, -this.M10 / determinant, this.M00 / determinant));
        }
Beispiel #14
0
 private static Matrix2LR smethod_0(
     LongRational m00,
     LongRational m01,
     LongRational m10,
     LongRational m11)
 {
     return(new Matrix2LR(m00, m01, m10, m11));
 }
Beispiel #15
0
 private static Vector4LR smethod_0(
     LongRational x,
     LongRational y,
     LongRational z,
     LongRational w)
 {
     return(new Vector4LR(x, y, z, w));
 }
Beispiel #16
0
 public void Move(LongRational deltaX, LongRational deltaY)
 {
     if (!this.Initialized)
     {
         return;
     }
     this.point2LR_0.X += deltaX;
     this.point2LR_0.Y += deltaY;
     this.point2LR_1.X += deltaX;
     this.point2LR_1.Y += deltaY;
 }
Beispiel #17
0
 public Matrix3LR(IList <LongRational> elements)
 {
     this.M00 = elements[0];
     this.M01 = elements[1];
     this.M02 = elements[2];
     this.M10 = elements[3];
     this.M11 = elements[4];
     this.M12 = elements[5];
     this.M20 = elements[6];
     this.M21 = elements[7];
     this.M22 = elements[8];
 }
Beispiel #18
0
 public Matrix3LR(Matrix3LR m)
 {
     this.M00 = m.M00;
     this.M01 = m.M01;
     this.M02 = m.M02;
     this.M10 = m.M10;
     this.M11 = m.M11;
     this.M12 = m.M12;
     this.M20 = m.M20;
     this.M21 = m.M21;
     this.M22 = m.M22;
 }
Beispiel #19
0
 public Matrix3LR(Vector3LR column1, Vector3LR column2, Vector3LR column3)
 {
     this.M00 = column1.X;
     this.M01 = column2.X;
     this.M02 = column3.X;
     this.M10 = column1.Y;
     this.M11 = column2.Y;
     this.M12 = column3.Y;
     this.M20 = column1.Z;
     this.M21 = column2.Z;
     this.M22 = column3.Z;
 }
Beispiel #20
0
 private static Matrix3LR smethod_0(
     LongRational m00,
     LongRational m01,
     LongRational m02,
     LongRational m10,
     LongRational m11,
     LongRational m12,
     LongRational m20,
     LongRational m21,
     LongRational m22)
 {
     return(new Matrix3LR(m00, m01, m02, m10, m11, m12, m20, m21, m22));
 }
Beispiel #21
0
        public LongRational this[int index]
        {
            get
            {
                switch (index)
                {
                case 0:
                    return(this.M00);

                case 1:
                    return(this.M01);

                case 2:
                    return(this.M10);

                case 3:
                    return(this.M11);

                default:
                    throw new IndexOutOfRangeException("Invalid matrix index!");
                }
            }
            set
            {
                switch (index)
                {
                case 0:
                    this.M00 = value;
                    break;

                case 1:
                    this.M01 = value;
                    break;

                case 2:
                    this.M10 = value;
                    break;

                case 3:
                    this.M11 = value;
                    break;

                default:
                    throw new IndexOutOfRangeException("Invalid matrix index!");
                }
            }
        }
Beispiel #22
0
 public void Update(LongRational x, LongRational y)
 {
     if (this.point2LR_0.X > x)
     {
         this.point2LR_0.X = x;
     }
     if (this.point2LR_1.X < x)
     {
         this.point2LR_1.X = x;
     }
     if (this.point2LR_0.Y > y)
     {
         this.point2LR_0.Y = y;
     }
     if (!(this.point2LR_1.Y < y))
     {
         return;
     }
     this.point2LR_1.Y = y;
 }
Beispiel #23
0
        public static int CompareAngles(Vector2LR a, Vector2LR b)
        {
            int quadrant1 = Vector2LR.GetQuadrant(a);
            int quadrant2 = Vector2LR.GetQuadrant(b);

            if (quadrant1 < quadrant2)
            {
                return(-1);
            }
            if (quadrant1 > quadrant2)
            {
                return(1);
            }
            LongRational longRational = Vector2LR.CrossProduct(a, b);

            if (longRational.IsNegative)
            {
                return(1);
            }
            return(longRational.IsPositive ? -1 : 0);
        }
Beispiel #24
0
 public Matrix3LR(
     double m00,
     double m01,
     double m02,
     double m10,
     double m11,
     double m12,
     double m20,
     double m21,
     double m22)
 {
     this.M00 = (LongRational)m00;
     this.M01 = (LongRational)m01;
     this.M02 = (LongRational)m02;
     this.M10 = (LongRational)m10;
     this.M11 = (LongRational)m11;
     this.M12 = (LongRational)m12;
     this.M20 = (LongRational)m20;
     this.M21 = (LongRational)m21;
     this.M22 = (LongRational)m22;
 }
Beispiel #25
0
 public Matrix3LR(
     LongRational m00,
     LongRational m01,
     LongRational m02,
     LongRational m10,
     LongRational m11,
     LongRational m12,
     LongRational m20,
     LongRational m21,
     LongRational m22)
 {
     this.M00 = m00;
     this.M01 = m01;
     this.M02 = m02;
     this.M10 = m10;
     this.M11 = m11;
     this.M12 = m12;
     this.M20 = m20;
     this.M21 = m21;
     this.M22 = m22;
 }
Beispiel #26
0
        public LongRational GetMinor(int removeRow, int removeColumn)
        {
            int          num1 = 0;
            LongRational zero = LongRational.Zero;

            for (int index1 = 0; index1 < 2; ++index1)
            {
                int num2 = 0;
                if (index1 != removeRow)
                {
                    for (int index2 = 0; index2 < 2; ++index2)
                    {
                        if (index2 != removeColumn)
                        {
                            zero = this[index1, index2];
                            ++num2;
                        }
                    }
                    ++num1;
                }
            }
            return(zero);
        }
Beispiel #27
0
 public static Vector2LR Multiply(Vector2LR u, LongRational s)
 {
     return(new Vector2LR(u.X * s, u.Y * s));
 }
Beispiel #28
0
 public static Vector2LR Divide(Vector2LR v, LongRational s)
 {
     return(new Vector2LR(v.X / s, v.Y / s));
 }
Beispiel #29
0
 public Vector2LR(int x, int y)
 {
     this.X = new LongRational(x);
     this.Y = new LongRational(y);
 }
Beispiel #30
0
 public Vector2LR(double x, double y)
 {
     this.X = (LongRational)x;
     this.Y = (LongRational)y;
 }