コード例 #1
0
        public void LocateCollinearReverse()
        {
            LineD reverseDiagD = diagD.Reverse();

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

            LineF reverseDiagF = diagF.Reverse();

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

            LineI reverseDiagI = diagI.Reverse();

            Assert.AreEqual(LineLocation.End, reverseDiagI.LocateCollinear(new PointI(0, 0)));
            Assert.AreEqual(LineLocation.Start, reverseDiagI.LocateCollinear(new PointI(2, 2)));
            Assert.AreEqual(LineLocation.After, reverseDiagI.LocateCollinear(new PointI(-1, -1)));
            Assert.AreEqual(LineLocation.Between, reverseDiagI.LocateCollinear(new PointI(1, 1)));
            Assert.AreEqual(LineLocation.Before, reverseDiagI.LocateCollinear(new PointI(3, 3)));
            Assert.AreEqual(LineLocation.Between, reverseDiagI.LocateCollinear(new PointI(0, 1)));
            Assert.AreEqual(LineLocation.Between, reverseDiagI.LocateCollinear(new PointI(1, 0)));
        }
コード例 #2
0
        public void LocateCollinear()
        {
            Assert.AreEqual(LineLocation.Start, diagD.LocateCollinear(new PointD(0, 0)));
            Assert.AreEqual(LineLocation.End, diagD.LocateCollinear(new PointD(2, 2)));
            Assert.AreEqual(LineLocation.Before, diagD.LocateCollinear(new PointD(-1, -1)));
            Assert.AreEqual(LineLocation.Between, diagD.LocateCollinear(new PointD(1, 1)));
            Assert.AreEqual(LineLocation.After, diagD.LocateCollinear(new PointD(3, 3)));
            Assert.AreEqual(LineLocation.Between, diagD.LocateCollinear(new PointD(0, 1)));
            Assert.AreEqual(LineLocation.Between, diagD.LocateCollinear(new PointD(1, 0)));

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

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