Beispiel #1
0
        public double GetAngle()
        {
            CVeObj cVeObj     = new CVeObj(1.0, 0.0);
            double dotProduct = this.GetDotProduct(cVeObj);
            double num        = this.GetLength() * cVeObj.GetLength();
            double result;

            if (1E-10 >= Math.Abs(num))
            {
                result = 0.0;
            }
            else
            {
                double num2 = dotProduct / num;
                if (Math.Abs(num2) > 0.99999999 && Math.Abs(num2) < 1.00000001)
                {
                    num2 = (double)((num2 > 0.0) ? 1 : -1);
                }
                double num3 = Math.Acos(num2);
                num3 *= 57.295779513082323;
                if (this.double_1 < 0.0)
                {
                    num3 = 360.0 - num3;
                }
                result = num3;
            }
            return(result);
        }
Beispiel #2
0
        public double GetAngleToLine(CLinesect tLine)
        {
            CVeObj vecOb  = this.GetVecOb();
            CVeObj vecOb2 = tLine.GetVecOb();

            return(vecOb.GetAngleToVe(vecOb2));
        }
Beispiel #3
0
        public CVeObj GetDroopVe(CVeObj veObj)
        {
            new CVeObj();
            CVeObj unitVe = this.GetUnitVe();

            return(unitVe.GetVeNumProduct(unitVe.GetDotProduct(veObj)));
        }
Beispiel #4
0
        public bool IsPtOnLineExt(GPoint tPoint)
        {
            CVeObj cVeObj  = new CVeObj(this.gpoint_0, tPoint);
            CVeObj cVeObj2 = new CVeObj(tPoint, this.gpoint_1);

            return(cVeObj.X * cVeObj2.Y - cVeObj2.X * cVeObj.Y < 1E-08);
        }
Beispiel #5
0
        private CLinesect method_4(double dNum)
        {
            CVeObj cVeObj      = new CVeObj(new GPoint(0.0, 0.0), this.GetFirstPt());
            CVeObj cVeObj2     = new CVeObj(new GPoint(0.0, 0.0), this.GetSecondPt());
            CVeObj angleUnitVe = CVeObj.GetAngleUnitVe(this.GetAngle() + 90.0);

            cVeObj  += angleUnitVe.GetVeNumProduct(dNum);
            cVeObj2 += angleUnitVe.GetVeNumProduct(dNum);
            return(new CLinesect(cVeObj.X, cVeObj.Y, cVeObj2.X, cVeObj2.Y));
        }
Beispiel #6
0
        public static GPoint GetDroopPoint(GPoint ptLnBeg, GPoint ptLnEnd, GPoint objPoint)
        {
            CVeObj cVeObj  = new CVeObj(ptLnBeg, ptLnEnd);
            CVeObj veObj   = new CVeObj(ptLnBeg, objPoint);
            CVeObj droopVe = cVeObj.GetDroopVe(veObj);
            GPoint gPoint  = new GPoint(droopVe.X, droopVe.Y);

            gPoint.OffSet(ptLnBeg);
            return(gPoint);
        }
Beispiel #7
0
        public CVeObj GetUnitVe()
        {
            CVeObj cVeObj = new CVeObj();
            double length = this.GetLength();
            CVeObj result;

            if (1E-16 >= length)
            {
                result = cVeObj;
            }
            else
            {
                cVeObj.X = this.double_0 / length;
                cVeObj.Y = this.double_1 / length;
                result   = cVeObj;
            }
            return(result);
        }
Beispiel #8
0
        public double GetLenPtToLine(GPoint tPoint)
        {
            CVeObj cVeObj  = new CVeObj(this.gpoint_0, tPoint);
            CVeObj cVeObj2 = new CVeObj(this.gpoint_0, this.gpoint_1);
            double length  = cVeObj2.GetLength();
            double result;

            if (length < 1E-16)
            {
                result = cVeObj.GetLength();
            }
            else
            {
                double num = Math.Abs(cVeObj2.GetArrowProduct(cVeObj));
                result = num / length;
            }
            return(result);
        }
Beispiel #9
0
        public bool IsPtOnLine(GPoint tPoint)
        {
            bool result;

            if (tPoint == this.gpoint_0 || tPoint == this.gpoint_1)
            {
                result = true;
            }
            else
            {
                CVeObj cVeObj  = new CVeObj(this.gpoint_0, tPoint);
                CVeObj cVeObj2 = new CVeObj(tPoint, this.gpoint_1);
                CVeObj unitVe  = cVeObj.GetUnitVe();
                CVeObj unitVe2 = cVeObj2.GetUnitVe();
                result = (unitVe == unitVe2);
            }
            return(result);
        }
Beispiel #10
0
        public double GetAngleToVe(CVeObj veObj)
        {
            double dotProduct = this.GetDotProduct(veObj);
            double num        = this.GetLength() * veObj.GetLength();
            double result;

            if (1E-10 >= Math.Abs(num))
            {
                result = 0.0;
            }
            else
            {
                double num2 = dotProduct / num;
                if (Math.Abs(num2) > 0.99999999 && Math.Abs(num2) < 1.00000001)
                {
                    num2 = (double)((num2 > 0.0) ? 1 : -1);
                }
                double num3 = Math.Acos(num2);
                result = num3 * 57.295779513082323;
            }
            return(result);
        }
Beispiel #11
0
 public double GetArrowProduct(CVeObj veObj)
 {
     return(this.double_0 * veObj.Y - this.double_1 * veObj.X);
 }
Beispiel #12
0
 public double GetDotProduct(CVeObj veObj)
 {
     return(this.double_0 * veObj.X + this.double_1 * veObj.Y);
 }
Beispiel #13
0
        public double GetAngle()
        {
            CVeObj vecOb = this.GetVecOb();

            return(vecOb.GetAngle());
        }
Beispiel #14
0
        public double GetAngleToPt(double toX, double toY)
        {
            CVeObj veToPt = this.GetVeToPt(new GPoint(toX, toY));

            return(veToPt.GetAngle());
        }
Beispiel #15
0
        public double GetAngleToPt(GPoint toPoint)
        {
            CVeObj veToPt = this.GetVeToPt(toPoint);

            return(veToPt.GetAngle());
        }