示例#1
0
        public void LocateReverse()
        {
            LineD reverseDiagD = diagD.Reverse();

            Assert.AreEqual(LineLocation.End, reverseDiagD.Locate(new PointD(0, 0)));
            Assert.AreEqual(LineLocation.Start, reverseDiagD.Locate(new PointD(2, 2)));
            Assert.AreEqual(LineLocation.After, reverseDiagD.Locate(new PointD(-1, -1)));
            Assert.AreEqual(LineLocation.Between, reverseDiagD.Locate(new PointD(1, 1)));
            Assert.AreEqual(LineLocation.Before, reverseDiagD.Locate(new PointD(3, 3)));
            Assert.AreEqual(LineLocation.Right, reverseDiagD.Locate(new PointF(0, 1)));
            Assert.AreEqual(LineLocation.Left, reverseDiagD.Locate(new PointF(1, 0)));

            LineF reverseDiagF = diagF.Reverse();

            Assert.AreEqual(LineLocation.End, reverseDiagF.Locate(new PointF(0, 0)));
            Assert.AreEqual(LineLocation.Start, reverseDiagF.Locate(new PointF(2, 2)));
            Assert.AreEqual(LineLocation.After, reverseDiagF.Locate(new PointF(-1, -1)));
            Assert.AreEqual(LineLocation.Between, reverseDiagF.Locate(new PointF(1, 1)));
            Assert.AreEqual(LineLocation.Before, reverseDiagF.Locate(new PointF(3, 3)));
            Assert.AreEqual(LineLocation.Right, reverseDiagF.Locate(new PointI(0, 1)));
            Assert.AreEqual(LineLocation.Left, reverseDiagF.Locate(new PointI(1, 0)));

            LineI reverseDiagI = diagI.Reverse();

            Assert.AreEqual(LineLocation.End, reverseDiagI.Locate(new PointI(0, 0)));
            Assert.AreEqual(LineLocation.Start, reverseDiagI.Locate(new PointI(2, 2)));
            Assert.AreEqual(LineLocation.After, reverseDiagI.Locate(new PointI(-1, -1)));
            Assert.AreEqual(LineLocation.Between, reverseDiagI.Locate(new PointI(1, 1)));
            Assert.AreEqual(LineLocation.Before, reverseDiagI.Locate(new PointI(3, 3)));
            Assert.AreEqual(LineLocation.Right, reverseDiagI.Locate(new PointI(0, 1)));
            Assert.AreEqual(LineLocation.Left, reverseDiagI.Locate(new PointI(1, 0)));
        }
示例#2
0
        public void Locate()
        {
            Assert.AreEqual(LineLocation.Start, diagD.Locate(new PointD(0, 0)));
            Assert.AreEqual(LineLocation.End, diagD.Locate(new PointD(2, 2)));
            Assert.AreEqual(LineLocation.Before, diagD.Locate(new PointD(-1, -1)));
            Assert.AreEqual(LineLocation.Between, diagD.Locate(new PointD(1, 1)));
            Assert.AreEqual(LineLocation.After, diagD.Locate(new PointD(3, 3)));
            Assert.AreEqual(LineLocation.Left, diagD.Locate(new PointF(0, 1)));
            Assert.AreEqual(LineLocation.Right, diagD.Locate(new PointF(1, 0)));

            Assert.AreEqual(LineLocation.Start, diagF.Locate(new PointF(0, 0)));
            Assert.AreEqual(LineLocation.End, diagF.Locate(new PointF(2, 2)));
            Assert.AreEqual(LineLocation.Before, diagF.Locate(new PointF(-1, -1)));
            Assert.AreEqual(LineLocation.Between, diagF.Locate(new PointF(1, 1)));
            Assert.AreEqual(LineLocation.After, diagF.Locate(new PointF(3, 3)));
            Assert.AreEqual(LineLocation.Left, diagF.Locate(new PointI(0, 1)));
            Assert.AreEqual(LineLocation.Right, diagF.Locate(new PointI(1, 0)));

            Assert.AreEqual(LineLocation.Start, diagI.Locate(new PointI(0, 0)));
            Assert.AreEqual(LineLocation.End, diagI.Locate(new PointI(2, 2)));
            Assert.AreEqual(LineLocation.Before, diagI.Locate(new PointI(-1, -1)));
            Assert.AreEqual(LineLocation.Between, diagI.Locate(new PointI(1, 1)));
            Assert.AreEqual(LineLocation.After, diagI.Locate(new PointI(3, 3)));
            Assert.AreEqual(LineLocation.Left, diagI.Locate(new PointI(0, 1)));
            Assert.AreEqual(LineLocation.Right, diagI.Locate(new PointI(1, 0)));
        }