A line which is bounded by a start and end point
Inheritance: UnboundedLine
Example #1
0
        public void Can_be_constructed_from_start_and_end_points()
        {
            SUT = new BoundedLine(startPoint, vectorOfLine);

            Assert.AreEqual(2, SUT.X);
            Assert.AreEqual(3, SUT.Y);
            Assert.AreEqual(4, SUT.Z);

            Assert.AreEqual(2, SUT.Vector.X);
            Assert.AreEqual(3, SUT.Vector.Y);
            Assert.AreEqual(4, SUT.Vector.Z);

            Assert.AreEqual(3, SUT.Start.X);
            Assert.AreEqual(4, SUT.Start.Y);
            Assert.AreEqual(5, SUT.Start.Z);

            Assert.AreEqual(5, SUT.End.X);
            Assert.AreEqual(7, SUT.End.Y);
            Assert.AreEqual(9, SUT.End.Z);
        }
Example #2
0
        public void Can_determine_if_point_is_on_the_line()
        {
            vectorOfLine = new GeometricVector(2, 2, 2);
            startPoint = new CartesianPoint(3, 4, 5);
            SUT = new BoundedLine(startPoint, vectorOfLine);

            CartesianPoint pointOnTheLine = new CartesianPoint(4, 5, 6);
            CartesianPoint pointAtEndOfLine = new CartesianPoint(5, 6, 7);
            CartesianPoint pointAtStartOfLine = new CartesianPoint(3, 4, 5);

            CartesianPoint pointBeyondEndOfLine = new CartesianPoint(6, 7, 8);
            CartesianPoint pointBeyondStartOfLine = new CartesianPoint(2, 3, 4);

            Assert.IsTrue(SUT.IsOnLine(pointOnTheLine));
            Assert.IsTrue(SUT.IsOnLine(pointAtEndOfLine));
            Assert.IsTrue(SUT.IsOnLine(pointAtStartOfLine));
            Assert.IsFalse(SUT.IsOnLine(pointBeyondEndOfLine));
            Assert.IsFalse(SUT.IsOnLine(pointBeyondStartOfLine));
        }
Example #3
0
 public void SetUp()
 {
     vectorOfLine = new GeometricVector(2, 3, 4);
     startPoint = new CartesianPoint(3, 4, 5);
     SUT = new BoundedLine(startPoint, vectorOfLine);
 }