コード例 #1
0
        public void GetIntersection_WLineSegment_Parallel_DifferentDirection_NoOverlap()
        {
            //arrange
            Geometry.MarginOfError   = 0.001;
            Geometry.CoordinatePlane = Geometry.CoordinatePlanes.Screen;
            WLineSegment a = new WLineSegment(new WPoint(0, 0), new WPoint(3, 0));
            WLineSegment b = new WLineSegment(new WPoint(6, 0), new WPoint(4, 0));
            //act
            Intersection resultA = a.GetIntersection(b);
            Intersection resultB = b.GetIntersection(a);

            //assert
            Assert.IsTrue(resultA.IsNone);
            Assert.IsTrue(resultB.IsNone);
        }
コード例 #2
0
        public void GetIntersection_WLineSegment_Parallel_SameDirection_OneEncompassingOverlap()
        {
            //arrange
            Geometry.MarginOfError   = 0.001;
            Geometry.CoordinatePlane = Geometry.CoordinatePlanes.Screen;
            WLineSegment a = new WLineSegment(new WPoint(0, 0), new WPoint(6, 0));
            WLineSegment b = new WLineSegment(new WPoint(3, 0), new WPoint(4, 0));
            //act
            Intersection resultA = a.GetIntersection(b);
            Intersection resultB = b.GetIntersection(a);

            //assert
            Assert.IsTrue(resultA.IsLineSegment);
            Assert.IsTrue(resultB.IsLineSegment);
            Assert.AreEqual(new WLineSegment(new WPoint(3, 0), new WPoint(4, 0)), resultA.LineSegment);
            Assert.AreEqual(new WLineSegment(new WPoint(3, 0), new WPoint(4, 0)), resultB.LineSegment);
        }